]> git.saurik.com Git - wxWidgets.git/commitdiff
Yield changes:
authorDavid Elliott <dfe@tgwbd.org>
Sun, 11 Apr 2004 04:09:20 +0000 (04:09 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Sun, 11 Apr 2004 04:09:20 +0000 (04:09 +0000)
1. Rework the loop using wxAutoNSAutoreleasePool such that each iteration
   (get/send event) is done within the context of an NSAutoreleasePool.
2. Use nil instead of [NSDate distantPast] (means the same thing)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/app.mm

index ee8284346b26cfd5cbc51d4a2ba5cc792e695d70..f44ff56c2db8ee049459beb20a5f0a2fec218263 100644 (file)
@@ -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];
     }