diff --git a/src/uvw/loop.h b/src/uvw/loop.h index 9832f0fd..98247daf 100644 --- a/src/uvw/loop.h +++ b/src/uvw/loop.h @@ -46,6 +46,7 @@ enum class UVRunMode: std::underlying_type_t { * 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. * diff --git a/test/uvw/timer.cpp b/test/uvw/timer.cpp index f07add7a..e484af09 100644 --- a/test/uvw/timer.cpp +++ b/test/uvw/timer.cpp @@ -122,3 +122,17 @@ TEST(Timer, Fake) { loop->run(); } + +TEST(Timer, BaseHandleWalk) { + auto loop = uvw::Loop::getDefault(); + auto timer = loop->resource(); + timer->on([](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(); +}