diff --git a/source/gui/detail/events_operation.cpp b/source/gui/detail/events_operation.cpp index 55c4234d..40fe338e 100644 --- a/source/gui/detail/events_operation.cpp +++ b/source/gui/detail/events_operation.cpp @@ -85,7 +85,7 @@ namespace nana if (reinterpret_cast(evt) == *i) { //Checks whether this event is working now. - if (emitting_count_ > 1) + if (emitting_count_) { static_cast(*i)->flag_deleted = true; deleted_flags_ = true; @@ -134,7 +134,11 @@ namespace nana for (auto i = evt_->dockers_->begin(); i != evt_->dockers_->end();) { if (static_cast(*i)->flag_deleted) + { + bedrock::instance().evt_operation().cancel(reinterpret_cast(*i)); + delete (*i); i = evt_->dockers_->erase(i); + } else ++i; }