]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch 1283609 GTK window dtor + wxGrid + cellEditor ==> crash
authorJulian Smart <julian@anthemion.co.uk>
Sun, 18 Sep 2005 10:11:36 +0000 (10:11 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 18 Sep 2005 10:11:36 +0000 (10:11 +0000)
David Surovell, OSAF

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/window.cpp
src/gtk1/window.cpp

index c6f04210f91a27f9773d486dffa54e4a05669f89..092022df0bc53126113e8c8b6b17b9b8c7cb7591 100644 (file)
@@ -2883,11 +2883,22 @@ wxWindowGTK::~wxWindowGTK()
     m_isBeingDeleted = true;
     m_hasVMT = false;
 
+    // destroy children before destroying this window itself
+    DestroyChildren();
+
+    // unhook focus handlers to prevent stray events being
+    // propagated to this (soon to be) dead object
+    if (m_focusWidget != NULL)
+    {
+        gtk_signal_disconnect_by_func( GTK_OBJECT(m_focusWidget),
+            (GtkSignalFunc) gtk_window_focus_in_callback, (gpointer) this );
+        gtk_signal_disconnect_by_func( GTK_OBJECT(m_focusWidget),
+            (GtkSignalFunc) gtk_window_focus_out_callback, (gpointer) this );
+    }
+
     if (m_widget)
         Show( false );
 
-    DestroyChildren();
-
 #ifdef HAVE_XIM
     if (m_ic)
         gdk_ic_destroy (m_ic);
index c6f04210f91a27f9773d486dffa54e4a05669f89..092022df0bc53126113e8c8b6b17b9b8c7cb7591 100644 (file)
@@ -2883,11 +2883,22 @@ wxWindowGTK::~wxWindowGTK()
     m_isBeingDeleted = true;
     m_hasVMT = false;
 
+    // destroy children before destroying this window itself
+    DestroyChildren();
+
+    // unhook focus handlers to prevent stray events being
+    // propagated to this (soon to be) dead object
+    if (m_focusWidget != NULL)
+    {
+        gtk_signal_disconnect_by_func( GTK_OBJECT(m_focusWidget),
+            (GtkSignalFunc) gtk_window_focus_in_callback, (gpointer) this );
+        gtk_signal_disconnect_by_func( GTK_OBJECT(m_focusWidget),
+            (GtkSignalFunc) gtk_window_focus_out_callback, (gpointer) this );
+    }
+
     if (m_widget)
         Show( false );
 
-    DestroyChildren();
-
 #ifdef HAVE_XIM
     if (m_ic)
         gdk_ic_destroy (m_ic);