[vlc-devel] [VLC 3.x v2 03/11] macosx: SPMediaKeyTap: Assert main thread is used
Marvin Scholz
epirat07 at gmail.com
Fri Apr 23 01:19:30 UTC 2021
---
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
--
2.30.1
More information about the vlc-devel
mailing list