Commit 7ce065dd authored by Felix Paul Kühne's avatar Felix Paul Kühne

vout_macosx: protect vout_display_SendEvent calls to prevent potential crashes

(cherry picked from commit 0a86a76fec01fe495ace7894c4ecb6be32b4fef7)

Conflicts:
	modules/video_output/macosx.m
parent a520ae9e
...@@ -14,6 +14,7 @@ Mac OS X: ...@@ -14,6 +14,7 @@ Mac OS X:
* Fix listing of the lua interfaces (web, telnet and console) * Fix listing of the lua interfaces (web, telnet and console)
in the advanced preferences panel in the advanced preferences panel
* Fix spatializer audio filter panel * Fix spatializer audio filter panel
* Fix crash within the video output code
Changes between 2.0.4 and 2.0.5: Changes between 2.0.4 and 2.0.5:
......
...@@ -708,10 +708,13 @@ static void OpenglSwap (vlc_gl_t *gl) ...@@ -708,10 +708,13 @@ static void OpenglSwap (vlc_gl_t *gl)
- (void)mouseDown:(NSEvent *)o_event - (void)mouseDown:(NSEvent *)o_event
{ {
if ([o_event type] == NSLeftMouseDown && !([o_event modifierFlags] & NSControlKeyMask)) @synchronized (self) {
{ if (vd) {
if ([o_event clickCount] <= 1) if ([o_event type] == NSLeftMouseDown && !([o_event modifierFlags] & NSControlKeyMask)) {
vout_display_SendEventMousePressed (vd, MOUSE_BUTTON_LEFT); if ([o_event clickCount] <= 1)
vout_display_SendEventMousePressed (vd, MOUSE_BUTTON_LEFT);
}
}
} }
[super mouseDown:o_event]; [super mouseDown:o_event];
...@@ -719,22 +722,32 @@ static void OpenglSwap (vlc_gl_t *gl) ...@@ -719,22 +722,32 @@ static void OpenglSwap (vlc_gl_t *gl)
- (void)otherMouseDown:(NSEvent *)o_event - (void)otherMouseDown:(NSEvent *)o_event
{ {
vout_display_SendEventMousePressed (vd, MOUSE_BUTTON_CENTER); @synchronized (self) {
if (vd)
vout_display_SendEventMousePressed (vd, MOUSE_BUTTON_CENTER);
}
[super otherMouseDown: o_event]; [super otherMouseDown: o_event];
} }
- (void)mouseUp:(NSEvent *)o_event - (void)mouseUp:(NSEvent *)o_event
{ {
if ([o_event type] == NSLeftMouseUp) @synchronized (self) {
vout_display_SendEventMouseReleased (vd, MOUSE_BUTTON_LEFT); if (vd) {
if ([o_event type] == NSLeftMouseUp)
vout_display_SendEventMouseReleased (vd, MOUSE_BUTTON_LEFT);
}
}
[super mouseUp: o_event]; [super mouseUp: o_event];
} }
- (void)otherMouseUp:(NSEvent *)o_event - (void)otherMouseUp:(NSEvent *)o_event
{ {
vout_display_SendEventMouseReleased (vd, MOUSE_BUTTON_CENTER); @synchronized (self) {
if (vd)
vout_display_SendEventMouseReleased (vd, MOUSE_BUTTON_CENTER);
}
[super otherMouseUp: o_event]; [super otherMouseUp: o_event];
} }
......
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