From 02c3e53b4506bc4ea6747e050c9bc9a8653cf779 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 18 Sep 2005 10:11:36 +0000 Subject: [PATCH] Applied patch 1283609 GTK window dtor + wxGrid + cellEditor ==> crash David Surovell, OSAF git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 15 +++++++++++++-- src/gtk1/window.cpp | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index c6f04210f9..092022df0b 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -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); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index c6f04210f9..092022df0b 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -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);