Commit 24d37952 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Move CVDisplayLink operations out of @synchronized blocks to avoid potential deadlock.

The -fire method called by the display link callback also synchronizes on self (while accessing the windows array). Display link operations use a lock to synchronize, too, and it's held while the callback is running. Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e90aaaab
......@@ -218,22 +218,26 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (void) addWindow:(WineWindow*)window
{
BOOL needsStart;
@synchronized(self) {
BOOL needsStart = !_windows.count;
needsStart = !_windows.count;
[_windows addObject:window];
if (needsStart)
CVDisplayLinkStart(_link);
}
if (needsStart)
CVDisplayLinkStart(_link);
}
- (void) removeWindow:(WineWindow*)window
{
BOOL shouldStop = FALSE;
@synchronized(self) {
BOOL wasRunning = _windows.count > 0;
[_windows removeObject:window];
if (wasRunning && !_windows.count)
CVDisplayLinkStop(_link);
shouldStop = TRUE;
}
if (shouldStop)
CVDisplayLinkStop(_link);
}
- (void) fire
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment