X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/524c47aa3adf2af11a3069fd5da035a604f08f66..c84030e020e56735cb4b7c1534e99d21a8bb48c0:/src/osx/carbon/dialog.cpp diff --git a/src/osx/carbon/dialog.cpp b/src/osx/carbon/dialog.cpp index 4779594662..9924b54b06 100644 --- a/src/osx/carbon/dialog.cpp +++ b/src/osx/carbon/dialog.cpp @@ -34,34 +34,32 @@ void wxDialog::DoShowModal() SetFocus() ; WindowRef windowRef = (WindowRef) GetWXWindow(); - WindowGroupRef windowGroup; - WindowGroupRef formerParentGroup; + WindowGroupRef windowGroup = NULL; + WindowGroupRef formerParentGroup = NULL; bool resetGroupParent = false; if ( GetParent() == NULL ) { windowGroup = GetWindowGroup(windowRef) ; - formerParentGroup = GetWindowGroupParent( windowGroup ); - SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) ); - resetGroupParent = true; + if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) ) + { + formerParentGroup = GetWindowGroupParent( windowGroup ); + SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) ); + resetGroupParent = true; + } } BeginAppModalStateForWindow(windowRef) ; - wxEventLoop * const - loop = wx_static_cast(wxEventLoop *, wxEventLoop::GetActive()); - - - wxASSERT_MSG( loop , wxT("No Event Loop in place") ); - - if ( loop ) - { - while ( IsModal() ) - loop->Dispatch(); - } +#if wxUSE_CONSOLE_EVENTLOOP + wxEventLoopGuarantor ensureHasLoop; +#endif + wxEventLoopBase * const loop = wxEventLoop::GetActive(); + while ( IsModal() ) + loop->Dispatch(); EndAppModalStateForWindow(windowRef) ; if ( resetGroupParent ) { SetWindowGroupParent( windowGroup , formerParentGroup ); } -} \ No newline at end of file +}