]> git.saurik.com Git - wxWidgets.git/commitdiff
Add check for destroying window with mouse capture in wxGTK.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Nov 2012 00:33:19 +0000 (00:33 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Nov 2012 00:33:19 +0000 (00:33 +0000)
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

index bd423501af5c7c797b517b5cc1d08f3ff7951e99..3090800b74d9f1c38c72ca6b257556096a1e0cba 100644 (file)
@@ -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)