2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-27 06:32:08 +00:00

Reapply double delete fix, which was overwritten by Networking TS merge.

This commit is contained in:
Christopher Kohlhoff
2017-12-02 08:21:52 +11:00
parent 2e61c6f29f
commit aa0bf0a8b3
2 changed files with 36 additions and 0 deletions

View File

@@ -385,6 +385,15 @@ void epoll_reactor::deregister_descriptor(socket_type descriptor,
reinterpret_cast<uintmax_t>(descriptor_data)));
scheduler_.post_deferred_completions(ops);
// Leave descriptor_data set so that it will be freed by the subsequent
// call to cleanup_descriptor_data.
}
else
{
// We are shutting down, so prevent cleanup_descriptor_data from freeing
// the descriptor_data object and let the destructor free it instead.
descriptor_data = 0;
}
}
@@ -413,6 +422,15 @@ void epoll_reactor::deregister_internal_descriptor(socket_type descriptor,
BOOST_ASIO_HANDLER_REACTOR_DEREGISTRATION((
context(), static_cast<uintmax_t>(descriptor),
reinterpret_cast<uintmax_t>(descriptor_data)));
// Leave descriptor_data set so that it will be freed by the subsequent
// call to cleanup_descriptor_data.
}
else
{
// We are shutting down, so prevent cleanup_descriptor_data from freeing
// the descriptor_data object and let the destructor free it instead.
descriptor_data = 0;
}
}

View File

@@ -329,6 +329,15 @@ void kqueue_reactor::deregister_descriptor(socket_type descriptor,
reinterpret_cast<uintmax_t>(descriptor_data)));
scheduler_.post_deferred_completions(ops);
// Leave descriptor_data set so that it will be freed by the subsequent
// call to cleanup_descriptor_data.
}
else
{
// We are shutting down, so prevent cleanup_descriptor_data from freeing
// the descriptor_data object and let the destructor free it instead.
descriptor_data = 0;
}
}
@@ -361,6 +370,15 @@ void kqueue_reactor::deregister_internal_descriptor(socket_type descriptor,
BOOST_ASIO_HANDLER_REACTOR_DEREGISTRATION((
context(), static_cast<uintmax_t>(descriptor),
reinterpret_cast<uintmax_t>(descriptor_data)));
// Leave descriptor_data set so that it will be freed by the subsequent
// call to cleanup_descriptor_data.
}
else
{
// We are shutting down, so prevent cleanup_descriptor_data from freeing
// the descriptor_data object and let the destructor free it instead.
descriptor_data = 0;
}
}