summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}