corrected a crash in wxDialog::Show() which would happen if there was a

window in "pending for delete" queue before the call to this function


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1115 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-12-05 23:08:37 +00:00
parent ce2006370e
commit 9c9cff0b45

View File

@@ -309,7 +309,6 @@ bool wxDialog::Show(bool show)
{ {
m_hwndOldFocus = (WXHWND)::GetFocus(); m_hwndOldFocus = (WXHWND)::GetFocus();
wxList DisabledWindows;
if (m_modalShowing) if (m_modalShowing)
{ {
BringWindowToTop((HWND) GetHWND()); BringWindowToTop((HWND) GetHWND());
@@ -325,6 +324,13 @@ bool wxDialog::Show(bool show)
::EnableWindow((HWND) box->GetHWND(), FALSE); ::EnableWindow((HWND) box->GetHWND(), FALSE);
node = node->Next(); node = node->Next();
} }
// if we don't do it, some window might be deleted while we have pointers
// to them in our disabledWindows list and the program will crash when it
// will try to reenable them after the modal dialog end
wxTheApp->DeletePendingObjects();
wxList disabledWindows;
node = wxModelessWindows.First(); node = wxModelessWindows.First();
while (node) while (node)
{ {
@@ -332,7 +338,7 @@ bool wxDialog::Show(bool show)
if (::IsWindowEnabled((HWND) win->GetHWND())) if (::IsWindowEnabled((HWND) win->GetHWND()))
{ {
::EnableWindow((HWND) win->GetHWND(), FALSE); ::EnableWindow((HWND) win->GetHWND(), FALSE);
DisabledWindows.Append(win); disabledWindows.Append(win);
} }
node = node->Next(); node = node->Next();
} }
@@ -371,7 +377,7 @@ bool wxDialog::Show(bool show)
} }
} }
// dfgg: now must specifically re-enable all other app windows that we disabled earlier // dfgg: now must specifically re-enable all other app windows that we disabled earlier
node=DisabledWindows.First(); node=disabledWindows.First();
while(node) { while(node) {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = (wxWindow*) node->Data();
HWND hWnd = (HWND) win->GetHWND(); HWND hWnd = (HWND) win->GetHWND();