From 3aba082d50ed54fdde8993f0a1754cc93d2429ea Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Jan 2007 14:32:18 +0000 Subject: [PATCH] don't crash in dtor if the X11 window hadn't been created (patch 1640153) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 4 ++++ src/x11/window.cpp | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index edf3a0ad3b..3ccc2e61a8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -109,6 +109,10 @@ wxMac - Added support for the wxFRAME_FLOAT_ON_PARENT style +wxX11: + +- Don't crash in wxWindow dtor if the window hadn't been really Create()d + 2.8.1 ----- diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 9c5f6f49b8..f10becfa7f 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -357,10 +357,13 @@ wxWindowX11::~wxWindowX11() } // Destroy the window - Window xwindow = (Window) m_mainWindow; - wxDeleteWindowFromTable( xwindow ); - XDestroyWindow( wxGlobalDisplay(), xwindow ); - m_mainWindow = NULL; + if ( m_mainWindow ) + { + Window xwindow = (Window) m_mainWindow; + wxDeleteWindowFromTable( xwindow ); + XDestroyWindow( wxGlobalDisplay(), xwindow ); + m_mainWindow = NULL; + } } // --------------------------------------------------------------------------- -- 2.45.2