Skip to content

Commit

Permalink
Merge pull request #6161 from anmelleSlamcore/fix_v4l_unique_ptr_func…
Browse files Browse the repository at this point in the history
…tion_wrapper

Ensure custom deleter is called by passing non-null pointer in ctor
  • Loading branch information
ev-mp authored Mar 30, 2020
2 parents 0a2e82b + fe09b12 commit 44e4cfb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/linux/backend-v4l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,12 @@ namespace librealsense
bool md_extracted = false;
buffers_mgr buf_mgr(_use_memory_map);
// RAII to handle exceptions
std::unique_ptr<int, std::function<void(int*)> > md_poller(nullptr,
[this,&buf_mgr,&md_extracted,&fds](int* d){ if (!md_extracted) acquire_metadata(buf_mgr,fds);});
std::unique_ptr<int, std::function<void(int*)> > md_poller(new int(0),
[this,&buf_mgr,&md_extracted,&fds](int* d)
{
if (!md_extracted) acquire_metadata(buf_mgr,fds);
delete d;
});

if(FD_ISSET(_fd, &fds))
{
Expand Down

0 comments on commit 44e4cfb

Please sign in to comment.