]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dialog.cpp
linking fix for wxUSE_VALIDATORS==0
[wxWidgets.git] / src / osx / carbon / dialog.cpp
index 8855697d645486c0ff0b6dd279cbda663da05907..84dbc61448b604236c2d04bde28cd9a9e0a3b7aa 100644 (file)
@@ -41,23 +41,19 @@ void wxDialog::DoShowModal()
     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 = static_cast<wxEventLoop *>(wxEventLoop::GetActive());
-
-
-    wxASSERT_MSG( loop , wxT("No Event Loop in place") );
-
-    if ( loop )
-    {
-        while ( IsModal() )
-            loop->Dispatch();
-    }
+    wxEventLoopGuarantor ensureHasLoop;
+    wxEventLoopBase * const loop = wxEventLoop::GetActive();
+    while ( IsModal() )
+        loop->Dispatch();
 
     EndAppModalStateForWindow(windowRef) ;
     if ( resetGroupParent )