fix crash caused by an wxMDIClientWindow's GTK signal handler being called when the wxMDIClientWindow is already (partially) destroyed: easily reproducible (without this fix) in the 'mdi' and 'svg' samples

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-03-14 01:24:45 +00:00
parent 49e3b82c03
commit 5a0a15cf56
2 changed files with 14 additions and 0 deletions

View File

@@ -140,6 +140,7 @@ class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
{ {
public: public:
wxMDIClientWindow() { } wxMDIClientWindow() { }
~wxMDIClientWindow();
virtual bool CreateClient(wxMDIParentFrame *parent, virtual bool CreateClient(wxMDIParentFrame *parent,
long style = wxVSCROLL | wxHSCROLL); long style = wxVSCROLL | wxHSCROLL);

View File

@@ -377,6 +377,19 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
wxMDIClientWindow::~wxMDIClientWindow()
{
// disconnect our handler because our ~wxWindow (which is going to be called
// after this dtor) will call DestroyChildren(); in turns our children
// ~wxWindow dtors will call wxWindow::Show(false) and this will generate
// a call to gtk_mdi_page_change_callback with an invalid parent
// (because gtk_mdi_page_change_callback expects a wxMDIClientWindow but
// at that point of the dtor chain we are a simple wxWindow!)
g_signal_handlers_disconnect_by_func(m_widget,
(gpointer)gtk_mdi_page_change_callback,
GetParent());
}
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
{ {
if ( !PreCreation( parent, wxDefaultPosition, wxDefaultSize ) || if ( !PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||