From 00f028e500c85c9db67b3bb5d3713a1edca8fbaf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 23 May 2007 23:40:12 +0000 Subject: [PATCH] don't crash in dtor if the dialog had never been shown (patch 1723848) [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46184 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/fdrepdlg.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/msw/fdrepdlg.cpp b/src/msw/fdrepdlg.cpp index 1c2006f35d..5bdf6b529d 100644 --- a/src/msw/fdrepdlg.cpp +++ b/src/msw/fdrepdlg.cpp @@ -381,20 +381,23 @@ wxFindReplaceDialog::wxFindReplaceDialog(wxWindow *parent, wxFindReplaceDialog::~wxFindReplaceDialog() { - // the dialog might have been already deleted if the user closed it - // manually but in this case we should have got a notification about it and - // the flagmust have been set - if ( !m_impl->WasClosedByUser() ) + if ( m_impl ) { - // if it wasn't, delete the dialog ourselves - if ( !::DestroyWindow(GetHwnd()) ) + // the dialog might have been already deleted if the user closed it + // manually but in this case we should have got a notification about it + // and the flag must have been set + if ( !m_impl->WasClosedByUser() ) { - wxLogLastError(_T("DestroyWindow(find dialog)")); + // if it wasn't, delete the dialog ourselves + if ( !::DestroyWindow(GetHwnd()) ) + { + wxLogLastError(_T("DestroyWindow(find dialog)")); + } } - } - // unsubclass the parent - delete m_impl; + // unsubclass the parent + delete m_impl; + } // prevent the base class dtor from trying to hide us! m_isShown = false;