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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2016-02-17 13:42:54 -06:00 committed by Alexandre Julliard
parent 58719f60d5
commit e5c120893d
1 changed files with 5 additions and 0 deletions

View File

@ -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];
}
}