From 8bb4495d952ba5c092f7d2790772bc26146a7627 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 29 Jun 2016 17:55:17 +0200 Subject: [PATCH] Remove mouse capture assert from wxGTK wxWindow dtor This assert was redundant as a similar check is done in the base class dtor. And while usually this assert is just annoying, instead of being helpful, when running the unit test suite which installs a custom assert handler throwing an exception, it is actively harmful as generating 2 asserts during the destruction of a window with mouse capture results in immediate termination (even in C++98 mode, unfortunately the whole idea of throwing from dtor is probably unsalvageable anyhow when using C++11). --- src/gtk/window.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 087a0a8d04..d9890dab67 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2604,15 +2604,12 @@ wxWindowGTK::~wxWindowGTK() if ( gs_deferredFocusOut == this ) gs_deferredFocusOut = NULL; - // Unlike the above cases, which can happen in normal circumstances, a - // window shouldn't be destroyed while it still has capture, so even though - // we still reset the global pointer to avoid leaving it dangling and - // crashing afterwards, also complain about it. + // This is a real error, unlike the above, but it's already checked for in + // the base class dtor and asserting here results is useless and, even + // worse, results in abnormal termination when running unit tests which + // throw exceptions from their assert handler, so don't assert here. if ( g_captureWindow == this ) - { - wxFAIL_MSG( wxS("Destroying window with mouse capture") ); g_captureWindow = NULL; - } if (m_wxwindow) {