diff --git a/src/yvalve/why.cpp b/src/yvalve/why.cpp index bf4d9d421c..c40abfcccd 100644 --- a/src/yvalve/why.cpp +++ b/src/yvalve/why.cpp @@ -3872,9 +3872,15 @@ FB_API_HANDLE& YEvents::getHandle() void YEvents::destroy(unsigned dstrFlags) { attachment->childEvents.remove(this); - removeHandle(&events, handle); + if (!(dstrFlags & DF_RELEASE)) + { + const bool allowCancel = destroyed.compareExchange(0, 1); + if (!allowCancel) + return; + } + destroy2(dstrFlags); }