]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
and restored error checking too: this completes sequence of 3 check ins making wx...
[wxWidgets.git] / 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);