]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dialog.cpp
Implement native OS X ComboBox for OS X Cocoa, and implement wxTextEntry methods...
[wxWidgets.git] / src / osx / carbon / dialog.cpp
index 47795946625287f51caf09a7f21bf9cc5377e056..9924b54b06028dce197d051d1bf270542c30ac55 100644 (file)
@@ -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
+}