X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/45cecdf9436fbfb7776f8ac610b280311d497ad7..bc9d3d911cfb51f612a699d7fb00f57eb5b2097c:/src/common/socket.cpp diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 0d619a77c2..6f32e83791 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -887,8 +887,12 @@ bool wxSocketBase::Destroy() Notify(false); // Schedule this object for deletion instead of destroying it right now if - // possible as we may have other events pending for it - if ( wxTheApp ) + // it can have other events pending for it and we have a way to do it. + // + // Notice that sockets used in other threads won't have any events for them + // and we shouldn't use delayed destruction mechanism for them as it's not + // MT-safe. + if ( wxIsMainThread() && wxTheApp ) { wxTheApp->ScheduleForDestruction(this); }