Skip to content

Interface/vout window race condition on MacOSX

The shared state between MacOSX Interface and vout window (macosx.m) is not correctly handled and lead to crash. I've attached two screenshots here: the first shows a dialog window that get shown at the startup of the interface and delay its setup, and the second shows the crash happening.

As far as I understand this issue, the main point here is that MacOSX external window should check the shared state between the interface and avoid crashing by failing instead. I don't know whether it would lead to the second issue, being that MacOSX interface would not be loaded at all and MacOSX vout window would fail.

According to the stacktrace though, I have the feeling that the macosx interface is enough started to signal that it will be existing. I cannot reproduce to test though since I cannot reproduce after confirming the bug, but we should be able to setup the necessary tests in the following function.

	5   libmacosx_plugin.dylib              0x000000011828cdd6 -[VLCVideoOutputProvider setupVoutForWindow:withProposedVideoViewPosition:] + 4230

The stacktrace:

╰─$ ./bin/vlc-osx-static ~/Desktop/foo                                                  130 ↵
VLC media player 4.0.0-dev Otto Chriek (revision 4.0.0-dev-13146-gfb11841382)
[00007ffee0c05010] main generic error: cannot load plug-in /Users/unidan/Workspace/vlc/build-macosx/modules/.libs/libebur128_plugin.dylib: dlopen(/Users/unidan/Workspace/vlc/build-macosx/modules/.libs/libebur128_plugin.dylib, 1): Library not loaded: libebur128.1.dylib
  Referenced from: /Users/unidan/Workspace/vlc/build-macosx/modules/.libs/libebur128_plugin.dylib
  Reason: image not found
[00007ffdb840e3d0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00007ffdb8840c00] videotoolbox decoder: Using Video Toolbox to decode 'h264'
2020-09-20 18:53:52.746 vlc-osx-static[32071:4353467] Can't find app with identifier com.apple.iTunes
2020-09-20 18:53:52.794 vlc-osx-static[32071:4353467] Can't find app with identifier com.spotify.client
2020-09-20 18:53:52.795 vlc-osx-static[32071:4353467] Can't find app with identifier com.apple.iTunes
2020-09-20 18:53:52.834 vlc-osx-static[32071:4353467] Can't find app with identifier com.spotify.client
2020-09-20 18:53:52.837 vlc-osx-static[32071:4353467] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: {length = 8, bytes = 0x306d47b8fd7f0000})'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff39838b57 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff7267f5bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff398e759e -[__NSCFString characterAtIndex:].cold.1 + 0
	3   CoreFoundation                      0x00007fff398f210c -[__NSDictionaryM setObject:forKey:].cold.3 + 0
	4   CoreFoundation                      0x00007fff39776299 -[__NSDictionaryM setObject:forKey:] + 976
	5   libmacosx_plugin.dylib              0x000000011828cdd6 -[VLCVideoOutputProvider setupVoutForWindow:withProposedVideoViewPosition:] + 4230
	6   libmacosx_plugin.dylib              0x000000011828edd7 __WindowEnable_block_invoke + 87
	7   libdispatch.dylib                   0x00007fff737ce658 _dispatch_client_callout + 8
	8   libdispatch.dylib                   0x00007fff737da7ab _dispatch_async_and_wait_invoke + 87
	9   libdispatch.dylib                   0x00007fff737ce658 _dispatch_client_callout + 8
	10  libdispatch.dylib                   0x00007fff737d9cab _dispatch_main_queue_callback_4CF + 936
	11  CoreFoundation                      0x00007fff397fbe81 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	12  CoreFoundation                      0x00007fff397bbc87 __CFRunLoopRun + 2028
	13  CoreFoundation                      0x00007fff397bae3e CFRunLoopRunSpecific + 462
	14  HIToolbox                           0x00007fff383e7abd RunCurrentEventLoopInMode + 292
	15  HIToolbox                           0x00007fff383e77d5 ReceiveNextEventCommon + 584
	16  HIToolbox                           0x00007fff383e7579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
	17  AppKit                              0x00007fff36a2d039 _DPSNextEvent + 883
	18  AppKit                              0x00007fff36a2b880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
	19  AppKit                              0x00007fff36d2def2 -[NSApplication _doModalLoop:peek:] + 315
	20  AppKit                              0x00007fff36d2cc85 __35-[NSApplication runModalForWindow:]_block_invoke_2 + 64
	21  AppKit                              0x00007fff36d2cc32 __35-[NSApplication runModalForWindow:]_block_invoke + 70
	22  AppKit                              0x00007fff36d2c4c4 _NSTryRunModal + 100
	23  AppKit                              0x00007fff36d2c3a9 -[NSApplication runModalForWindow:] + 128
	24  AppKit                              0x00007fff36eb57bc __19-[NSAlert runModal]_block_invoke_2 + 147
	25  AppKit                              0x00007fff36eb5716 __19-[NSAlert runModal]_block_invoke + 70
	26  AppKit                              0x00007fff36d2c4c4 _NSTryRunModal + 100
	27  AppKit                              0x00007fff36dc6d87 -[NSAlert runModal] + 121
	28  AppKit                              0x00007fff36a33bfe __55-[NSPersistentUIRestorer promptToIgnorePersistentState]_block_invoke + 908
	29  AppKit                              0x00007fff36a33833 -[NSApplication _suppressFinishLaunchingFromEventHandlersWhilePerformingBlock:] + 25
	30  AppKit                              0x00007fff36a337e3 -[NSPersistentUIRestorer promptToIgnorePersistentState] + 229
	31  AppKit                              0x00007fff36a334a4 -[NSApplication _reopenWindowsAsNecessaryIncludingRestorableState:completionHandler:] + 171
	32  AppKit                              0x00007fff36a332e6 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 536
	33  AppKit                              0x00007fff36a32f38 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 688
	34  Foundation                          0x00007fff3be2aa26 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308
	35  Foundation                          0x00007fff3be2a890 _NSAppleEventManagerGenericHandler + 98
	36  AE                                  0x00007fff3ab2f203 _AppleEventsCheckInAppWithBlock + 18103
	37  AE                                  0x00007fff3ab2e929 _AppleEventsCheckInAppWithBlock + 15837
	38  AE                                  0x00007fff3ab26bd7 aeProcessAppleEvent + 449
	39  HIToolbox                           0x00007fff383f97fa AEProcessAppleEvent + 54
	40  AppKit                              0x00007fff36a2d2d1 _DPSNextEvent + 1547
	41  AppKit                              0x00007fff36a2b880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
	42  AppKit                              0x00007fff36a1d58e -[NSApplication run] + 658
	43  vlc-osx-static                      0x000000010effd66d main + 1709
	44  libdyld.dylib                       0x00007fff73827cc9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]    32071 abort      ./bin/vlc-osx-static ~/Desktop/foo --play-and-exit
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information