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
     s_inYield = true;
 
     // Run the event loop until it is out of events
     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
                 nextEventMatchingMask:NSAnyEventMask
-                untilDate:[NSDate distantPast]
+                untilDate:nil /* ==[NSDate distantPast] */
                 inMode:NSDefaultRunLoopMode
                 inMode:NSDefaultRunLoopMode
+                dequeue: YES];
+        if(!event)
+            break;
         [GetNSApplication() sendEvent: event];
     }
 
         [GetNSApplication() sendEvent: event];
     }