From 7cd2b67ef130a3c60192133d946a22e47cbeec6c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 15 Mar 2017 19:07:01 +0300 Subject: fixes #747 (crash in options during SRMM plugin unload) --- src/mir_app/src/options.cpp | 4 +--- src/mir_core/src/ui_utils.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index d3f765f522..1e918e3dde 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -226,9 +226,7 @@ struct OptionsPageData : public MZeroedObject ~OptionsPageData() { - // if a dialog has window, it will be killed by WM_CLOSE event - if (pDialog && !pDialog->GetHwnd()) - delete pDialog; + delete pDialog; } CDlgBase *pDialog; diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index 20b2a34140..2c05d41c8a 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -67,6 +67,7 @@ CDlgBase::CDlgBase(HINSTANCE hInst, int idDialog) CDlgBase::~CDlgBase() { + m_initialized = false; // prevent double call of destructor if (m_hwnd) DestroyWindow(m_hwnd); } @@ -259,10 +260,12 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) arDialogs.remove(idx); } m_hwnd = NULL; - if (m_isModal) - m_isModal = false; - else // modeless dialogs MUST be allocated with 'new' - delete this; + if (m_initialized) { + if (m_isModal) + m_isModal = false; + else // modeless dialogs MUST be allocated with 'new' + delete this; + } return TRUE; } -- cgit v1.2.3