Skip to content

Ensure custom deleter is called by passing non-null pointer in ctor - #6161

Merged
ev-mp merged 1 commit into
realsenseai:developmentfrom
anmelle-slamcore:fix_v4l_unique_ptr_function_wrapper
Mar 30, 2020
Merged

Ensure custom deleter is called by passing non-null pointer in ctor#6161
ev-mp merged 1 commit into
realsenseai:developmentfrom
anmelle-slamcore:fix_v4l_unique_ptr_function_wrapper

Conversation

@anmelle-slamcore

Copy link
Copy Markdown
Contributor

Custom deleters for std::unique_ptr are not invoked if the owned pointer is null.
Therefore, the function setup to acquire_metadata at the end of the scope will never fire.

Solution is to pass a valid pointer, and let the custom deleter delete the object.

@dorodnic

dorodnic commented Mar 30, 2020

Copy link
Copy Markdown
Contributor

Hi @anmelleSlamcore
Thank you for the patch, I was not familiar with this behaviour.

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @anmelleSlamcore ,
Thank you for the contribution!

@ev-mp
ev-mp merged commit 44e4cfb into realsenseai:development Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants