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)