Ken Thomases : winemac: Wrap performing requests from background threads in an autorelease pool.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 18 10:14:55 CST 2016


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Feb 17 13:42:54 2016 -0600

winemac: Wrap performing requests from background threads in an autorelease pool.

Cocoa manages an autorelease pool on the main thread, but it only drains it
when it processes an event.  Our requests come through a run loop source, which
doesn't count as an event.  So, autoreleased objects can accumulate when the
app is not being interacted with.

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

---

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

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index fb9edc2..176d35c 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -2295,6 +2295,7 @@ static void PerformRequest(void *info)
 
     for (;;)
     {
+        NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
         __block dispatch_block_t block;
 
         dispatch_sync(controller->requestsManipQueue, ^{
@@ -2308,10 +2309,14 @@ static void PerformRequest(void *info)
         });
 
         if (!block)
+        {
+            [pool release];
             break;
+        }
 
         block();
         [block release];
+        [pool release];
     }
 }
 




More information about the wine-cvs mailing list