From 7df04680cbdafa88233c2b650c24d59fec9d458a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 24 Nov 2012 00:33:19 +0000 Subject: [PATCH] Add check for destroying window with mouse capture in wxGTK. We already have an assert checking for this at wxWindowBase level but it seems that it wasn't always triggered somehow (maybe because we crashed before getting there?), so do it sooner. Closes #14602. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index bd42350..3090800 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2380,6 +2380,16 @@ 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. + if ( g_captureWindow == this ) + { + wxFAIL_MSG( wxS("Destroying window with mouse capture") ); + g_captureWindow = NULL; + } + if (m_widget) GTKDisconnect(m_widget); if (m_wxwindow && m_wxwindow != m_widget) -- 2.7.4