X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/387a3b02e02d91da6c5d4331b667d835e32c83b0..90186e524e347a3a779c928a44fb7d744b3efcf7:/src/msw/dialog.cpp?ds=sidebyside diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 8f5afe79e7..af8ad17747 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -41,12 +41,13 @@ // for modal dialogs wxList wxModalDialogs; wxList wxModelessWindows; // Frames and modeless dialogs -extern wxList wxPendingDelete; +extern wxList WXDLLEXPORT wxPendingDelete; #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel) BEGIN_EVENT_TABLE(wxDialog, wxPanel) + EVT_SIZE(wxDialog::OnSize) EVT_BUTTON(wxID_OK, wxDialog::OnOK) EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) @@ -237,11 +238,6 @@ bool wxDialog::IsIconized(void) const return FALSE; } -void wxDialog::SetSize(int x, int y, int width, int height, int WXUNUSED(sizeFlags)) -{ - wxWindow::SetSize(x, y, width, height); -} - void wxDialog::SetClientSize(int width, int height) { HWND hWnd = (HWND) GetHWND(); @@ -309,7 +305,6 @@ bool wxDialog::Show(bool show) { m_hwndOldFocus = (WXHWND)::GetFocus(); - wxList DisabledWindows; if (m_modalShowing) { BringWindowToTop((HWND) GetHWND()); @@ -325,6 +320,13 @@ bool wxDialog::Show(bool show) ::EnableWindow((HWND) box->GetHWND(), FALSE); 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(); while (node) { @@ -332,7 +334,7 @@ bool wxDialog::Show(bool show) if (::IsWindowEnabled((HWND) win->GetHWND())) { ::EnableWindow((HWND) win->GetHWND(), FALSE); - DisabledWindows.Append(win); + disabledWindows.Append(win); } node = node->Next(); } @@ -371,7 +373,7 @@ bool wxDialog::Show(bool show) } } // dfgg: now must specifically re-enable all other app windows that we disabled earlier - node=DisabledWindows.First(); + node=disabledWindows.First(); while(node) { wxWindow* win = (wxWindow*) node->Data(); HWND hWnd = (HWND) win->GetHWND(); @@ -567,6 +569,16 @@ bool wxDialog::OnClose(void) return FALSE; } +void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event)) +{ + // if we're using constraints - do use them + #if wxUSE_CONSTRAINTS + if ( GetAutoLayout() ) { + Layout(); + } + #endif +} + void wxDialog::OnCloseWindow(wxCloseEvent& event) { // Compatibility