From 682baeba6f2bd5a3dcdef07abb79b8662be1301a Mon Sep 17 00:00:00 2001 From: hvlad Date: Thu, 22 Oct 2015 13:40:43 +0000 Subject: [PATCH] Fixed AV on client : when disconnect happens while event callback run --- src/yvalve/why.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); }