summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_gui.h1
-rw-r--r--src/mir_core/src/ui_utils.cpp9
2 files changed, 9 insertions, 1 deletions
diff --git a/include/m_gui.h b/include/m_gui.h
index 14e0e5b51c..0f3f161b60 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -405,6 +405,7 @@ protected:
bool m_isModal;
bool m_initialized;
bool m_forceResizable;
+ bool m_bExiting; // window received WM_CLOSE and gonna die soon
LRESULT m_lresult;
enum { CLOSE_ON_OK = 0x1, CLOSE_ON_CANCEL = 0x2 };
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp
index ddc1088705..ff4de03f6c 100644
--- a/src/mir_core/src/ui_utils.cpp
+++ b/src/mir_core/src/ui_utils.cpp
@@ -163,12 +163,15 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
if (idCode == BN_CLICKED) {
// close dialog automatically if 'Cancel' button is pressed
- if (idCtrl == IDCANCEL && (m_autoClose & CLOSE_ON_CANCEL))
+ if (idCtrl == IDCANCEL && (m_autoClose & CLOSE_ON_CANCEL)) {
+ m_bExiting = true;
PostMessage(m_hwnd, WM_CLOSE, 0, 0);
+ }
// close dialog automatically if 'OK' button is pressed
if (idCtrl == IDOK && (m_autoClose & CLOSE_ON_OK)) {
// validate dialog data first
+ m_bExiting = true;
m_lresult = TRUE;
NotifyControls(&CCtrlBase::OnApply);
OnApply();
@@ -176,6 +179,8 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
// everything ok? good, let's close it
if (m_lresult == TRUE)
PostMessage(m_hwnd, WM_CLOSE, 0, 0);
+ else
+ m_bExiting = false;
}
}
}
@@ -214,6 +219,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
case WM_CLOSE:
+ m_bExiting = true;
m_lresult = FALSE;
OnClose();
if (!m_lresult) {
@@ -225,6 +231,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
case WM_DESTROY:
+ m_bExiting = true;
OnDestroy();
NotifyControls(&CCtrlBase::OnDestroy);
{