summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa_common.m
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2017-02-23 01:37:23 +0100
committerAkemi <der.richter@gmx.de>2017-02-27 23:57:44 +0100
commit9bd819a0bc809ab5af300e5d73e88f120c5d0285 (patch)
tree136b475a23ba3c22eec79dd8bccd74327f2869a7 /video/out/cocoa_common.m
parent55fb4cb3f6938e8494b8b9a5eec9d56e656cf46b (diff)
downloadmpv-9bd819a0bc809ab5af300e5d73e88f120c5d0285.tar.bz2
mpv-9bd819a0bc809ab5af300e5d73e88f120c5d0285.tar.xz
cocoa: fix segfault in certain circumstances
i falsely assumed that the windowDidChangeScreen was meant to report ‘physical’ screen changes but was wondering why it triggers on other events too. it actually is a event that informs us when anything referenced by our current NSScreen is changed. even when something referenced in the NSScreen changed the old and new NSScreen are still equal if the physical screen didn’t change. with that my previous optimisation broke some cases where the physical screen didn’t change but things it referenced did, leading to a segfault when theses were accessed. to keep the optimisation we will always update our internal NSScreen reference but the rest only when the physical screen was changed.
Diffstat (limited to 'video/out/cocoa_common.m')
-rw-r--r--video/out/cocoa_common.m4
1 files changed, 4 insertions, 0 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index f59ffd9005..e3f359eb5c 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -1018,6 +1018,10 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
- (void)windowDidChangeScreen:(NSNotification *)notification
{
vo_cocoa_update_screen_info(self.vout);
+}
+
+- (void)windowDidChangePhysicalScreen
+{
vo_cocoa_update_displaylink(self.vout);
flag_events(self.vout, VO_EVENT_WIN_STATE);
}