diff --git a/src/uvw/handle.hpp b/src/uvw/handle.hpp index f3fcb6c7..ef59b779 100644 --- a/src/uvw/handle.hpp +++ b/src/uvw/handle.hpp @@ -42,8 +42,9 @@ class Handle: public BaseHandle, public Emitter, public Self { static void closeCallback(uv_handle_t *handle) { Handle &ref = *(static_cast(handle->data)); + auto ptr = ref.shared_from_this(); + ptr->reset(); ref.publish(CloseEvent{}); - ref.reset(); } protected: