vlc/vlc-3.0 | branch: master | Marvin Scholz <epira...@gmail.com> | Thu Apr 22 17:11:40 2021 +0200| [2d358c7fbb78efbd3e371a461c5e9fd2cef7a3f7] | committer: Marvin Scholz
macosx: SPMediaKeyTap: Assert main thread is used > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=2d358c7fbb78efbd3e371a461c5e9fd2cef7a3f7 --- modules/gui/macosx/SPMediaKeyTap.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/gui/macosx/SPMediaKeyTap.m b/modules/gui/macosx/SPMediaKeyTap.m index 03ce7e5426..d82babb4ed 100644 --- a/modules/gui/macosx/SPMediaKeyTap.m +++ b/modules/gui/macosx/SPMediaKeyTap.m @@ -94,6 +94,9 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv - (BOOL)startWatchingMediaKeys { + NSAssert([NSThread isMainThread], + @"startWatchingMediaKeys must be called on the main thread!"); + // Prevent having multiple mediaKeys threads [self stopWatchingMediaKeys]; @@ -124,6 +127,9 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv - (void)stopWatchingMediaKeys { + NSAssert([NSThread isMainThread], + @"stopWatchingMediaKeys must be called on the main thread!"); + // Remove runloop source if(_eventPortSource){ CFRunLoopRemoveSource(CFRunLoopGetCurrent(), _eventPortSource, kCFRunLoopCommonModes); @@ -263,6 +269,9 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv - (void)mediaKeyAppListChanged { + NSAssert([NSThread isMainThread], + @"mediaKeyAppListChanged must be called on the main thread!"); + #ifdef DEBUG_SPMEDIAKEY_APPLIST [self debugPrintAppList]; #endif _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits