Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

fix callback handler cleanup #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Boris-Rasin
Copy link

Make sure all handler instances are destroyed after completion. This
allows code to hold shared pointer to easy object inside it's
own completion functor:

auto easy = std::make_shared<curl::easy>(multi);
// ...
easy->async_perform([easy](const boost::system::error_code& ec)
{
    // ...
});

Previously this code lead to memory leak because of circular shared pointers. After this fix the code works as expected.

Make sure all handler instances are destroyed after completion. This
allows code to hold shared pointer to easy object inside handler it's
own completion functor.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant