Ken Thomases : winemac: Use a more idiomatic pattern for an autorelease pool around a loop.

Alexandre Julliard julliard at winehq.org
Fri Jun 3 10:03:45 CDT 2016


Module: wine
Branch: master
Commit: bdbb3514bb08e1deed99e39b1fe29fec5a366b29
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bdbb3514bb08e1deed99e39b1fe29fec5a366b29

Author: Ken Thomases <ken at codeweavers.com>
Date:   Fri Jun  3 00:06:48 2016 -0500

winemac: Use a more idiomatic pattern for an autorelease pool around a loop.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/cocoa_app.m | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index f64de31..dced704 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -2318,11 +2318,11 @@ static NSString* WineLocalizedString(unsigned int stringID)
  */
 static void PerformRequest(void *info)
 {
+    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
     WineApplicationController* controller = [WineApplicationController sharedController];
 
     for (;;)
     {
-        NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
         __block dispatch_block_t block;
 
         dispatch_sync(controller->requestsManipQueue, ^{
@@ -2336,15 +2336,16 @@ static void PerformRequest(void *info)
         });
 
         if (!block)
-        {
-            [pool release];
             break;
-        }
 
         block();
         [block release];
+
         [pool release];
+        pool = [[NSAutoreleasePool alloc] init];
     }
+
+    [pool release];
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list