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:
parent
58719f60d5
commit
e5c120893d
|
@ -2295,6 +2295,7 @@ static void PerformRequest(void *info)
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||||
__block dispatch_block_t block;
|
__block dispatch_block_t block;
|
||||||
|
|
||||||
dispatch_sync(controller->requestsManipQueue, ^{
|
dispatch_sync(controller->requestsManipQueue, ^{
|
||||||
|
@ -2308,10 +2309,14 @@ static void PerformRequest(void *info)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!block)
|
if (!block)
|
||||||
|
{
|
||||||
|
[pool release];
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
block();
|
block();
|
||||||
[block release];
|
[block release];
|
||||||
|
[pool release];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue