From 7cccf909767b7fa714050a50ad5b42ede22d1caa Mon Sep 17 00:00:00 2001 From: rogerman Date: Sun, 15 May 2022 08:21:29 -0700 Subject: [PATCH] Cocoa Port: Fix a crash that can occur when taking a display window full screen while running macOS El Capitan. (Regression from commit ebc39eae.) --- desmume/src/frontend/cocoa/cocoa_GPU.mm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/desmume/src/frontend/cocoa/cocoa_GPU.mm b/desmume/src/frontend/cocoa/cocoa_GPU.mm index b7e13e96b..11975799c 100644 --- a/desmume/src/frontend/cocoa/cocoa_GPU.mm +++ b/desmume/src/frontend/cocoa/cocoa_GPU.mm @@ -1391,15 +1391,20 @@ MacGPUFetchObjectDisplayLink::MacGPUFetchObjectDisplayLink() DisplayLinkListUpdate(); CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), - this, - ScreenChangeCallback, - CFSTR("NSApplicationDidChangeScreenParametersNotification"), - NULL, - CFNotificationSuspensionBehaviorDeliverImmediately); + this, + ScreenChangeCallback, + CFSTR("NSApplicationDidChangeScreenParametersNotification"), + NULL, + CFNotificationSuspensionBehaviorDeliverImmediately); } MacGPUFetchObjectDisplayLink::~MacGPUFetchObjectDisplayLink() { + CFNotificationCenterRemoveObserver(CFNotificationCenterGetLocalCenter(), + this, + CFSTR("NSApplicationDidChangeScreenParametersNotification"), + NULL); + pthread_mutex_lock(&this->_mutexDisplayLinkLists); while (this->_displayLinksActiveList.size() > 0)