From: Vadim Zeitlin Date: Sat, 24 Nov 2012 00:33:19 +0000 (+0000) Subject: Add check for destroying window with mouse capture in wxGTK. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7df04680cbdafa88233c2b650c24d59fec9d458a?ds=inline 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 --- diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index bd423501af..3090800b74 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)