basehandle::type() in uv_walk which is in a timer callback causes double free (#213)
Close #212
This commit is contained in:
parent
52785475b9
commit
a10844d4bf
@ -46,6 +46,7 @@ enum class UVRunMode: std::underlying_type_t<uv_run_mode> {
|
||||
* This can help to end all the pending requests by closing the handles.
|
||||
*/
|
||||
struct BaseHandle {
|
||||
virtual ~BaseHandle() = default;
|
||||
/**
|
||||
* @brief Gets the category of the handle.
|
||||
*
|
||||
|
||||
@ -122,3 +122,17 @@ TEST(Timer, Fake) {
|
||||
|
||||
loop->run();
|
||||
}
|
||||
|
||||
TEST(Timer, BaseHandleWalk) {
|
||||
auto loop = uvw::Loop::getDefault();
|
||||
auto timer = loop->resource<uvw::TimerHandle>();
|
||||
timer->on<uvw::TimerEvent>([](const auto &event, uvw::TimerHandle &handle) {
|
||||
auto &loop = handle.loop();
|
||||
loop.walk([](uvw::BaseHandle& h){
|
||||
h.type();
|
||||
});
|
||||
handle.close();
|
||||
});
|
||||
timer->start(uvw::TimerHandle::Time{1000}, uvw::TimerHandle::Time{1000});
|
||||
loop->run();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user