]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/app.mm
Script tweaks
[wxWidgets.git] / src / cocoa / app.mm
index ee8284346b26cfd5cbc51d4a2ba5cc792e695d70..2e01d1055863feed7ac24359ad7879442c6680d8 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2002/11/27
 // RCS-ID:      $Id$
 // Copyright:   (c) David Elliott
-// Licence:     wxWindows licence
+// Licence:     wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
@@ -119,7 +119,7 @@ WX_IMPLEMENT_POSER(wxPoserNSApplication);
 @implementation wxNSApplicationDelegate : NSObject
 
 // NOTE: Terminate means that the event loop does NOT return and thus
-// cleanup code doesn't properly execute.  Furthermore, wxWindows has its
+// cleanup code doesn't properly execute.  Furthermore, wxWidgets has its
 // own exit on frame delete mechanism.
 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
 {
@@ -306,12 +306,16 @@ bool wxApp::Yield(bool onlyIfNeeded)
     s_inYield = true;
 
     // Run the event loop until it is out of events
-    while(NSEvent *event = [GetNSApplication()
+    while(1)
+    {
+        wxAutoNSAutoreleasePool pool;
+        NSEvent *event = [GetNSApplication()
                 nextEventMatchingMask:NSAnyEventMask
-                untilDate:[NSDate distantPast]
+                untilDate:nil /* ==[NSDate distantPast] */
                 inMode:NSDefaultRunLoopMode
-                dequeue: YES])
-    {
+                dequeue: YES];
+        if(!event)
+            break;
         [GetNSApplication() sendEvent: event];
     }