summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-15 19:07:01 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-15 19:07:01 +0300
commit7cd2b67ef130a3c60192133d946a22e47cbeec6c (patch)
treee2adc01d5d517f7d5ebc48e62754652c93b76e8b
parentb225a055f5d3abc754899d115582f39cc2168f3f (diff)
fixes #747 (crash in options during SRMM plugin unload)
-rw-r--r--src/mir_app/src/options.cpp4
-rw-r--r--src/mir_core/src/ui_utils.cpp11
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;
}