Skip to content

Crash during quit in windowDidExitFullScreen #4020

@low-batt

Description

@low-batt

System and IINA version:

Expected behavior:
IINA does not crash when quitting.

Actual behavior:
During termination MainWindowController.windowDidExitFullScreen was called. MainWindowController called PlayerCore which called MPVController.getDouble. That method called mpv_get_property triggering a crash as IINA had already sent a quit command to mpv.

This is with the develop branch that contains changes to try and correct shutdown problems.

Xcode Console:
14:10:23.356 [iina][d] IINA 1.3.0 Build 131
14:10:23.358 [iina][d] Copyright © 2017-2022
14:10:23.358 [iina][d] Collider LI, et al.
14:10:23.358 [iina][d] Released under GPLv3.
14:10:23.358 [iina][d] FFmpeg 4.4.2
14:10:23.358 [iina][d]   libavcodec 58.134.100
14:10:23.358 [iina][d]   libavformat 58.76.100
14:10:23.358 [iina][d]   libavutil 56.70.100
14:10:23.358 [iina][d]   libswscale 5.9.100
14:10:23.358 [iina][d] App will launch
14:10:23.358 [iina][d] Got arguments ["-NSDocumentRevisionsDebugMode", "YES"]
14:10:23.358 [iina][d] IINA arguments: []
14:10:23.358 [iina][d] Filenames from arguments: []
IINA 1.3.0 Build 131
This binary is not intended for being used as a command line tool. Please use the bundled iina-cli.
Please ignore this message if you are running in a debug environment.
14:10:23.379 [iina][d] App launched
14:10:23.380 [iina][d] Loading key bindings
14:10:23.382 [iina][d] Set key bindings
2022-10-29 14:10:23.385423-0400 IINA[9185:878426] [logging] open flag(s) 0x01000000 are reserved for VFS use and do not affect behaviour when passed to sqlite3_open_v2
2022-10-29 14:10:23.385491-0400 IINA[9185:878426] [logging-persist] cannot open file at line 46922 of [6bf7a27121]
2022-10-29 14:10:23.385507-0400 IINA[9185:878426] [logging-persist] os_unix.c:46922: (0) open(/private/var/db/DetachedSignatures) - Undefined error: 0
2022-10-29 14:10:23.486631-0400 IINA[9185:877912] Metal API Validation Enabled
14:10:23.512 [player0][d] Set path to /Users/low-batt/Library/Developer/Xcode/DerivedData/iina-caydzgleiqupoxbtitkkfadxksfs/Build/Products/Debug/IINA.app/Contents/MacOS:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
2022-10-29 14:10:23.530162-0400 IINA[9185:877912] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000003c45e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
14:10:23.547 [iina][d] Using mpv 0.34.1
14:10:23.547 [iina][d] Setting up MediaPlayer integration
14:10:23.549 [player0][d] Track list changed
14:10:25.589 [player0][d] Open URL: file:///Users/low-batt/Movies/The%20World%20in%20HDR%20in%204K%20(ULTRA%20HD).mp4
14:10:25.589 [player0][d] Opening /Users/low-batt/Movies/The World in HDR in 4K (ULTRA HD).mp4 in main window
14:10:25.697 [iina][d] Created OpenGL pixel format with [__C._CGLPixelFormatAttribute(rawValue: 5), __C._CGLPixelFormatAttribute(rawValue: 96), __C._CGLPixelFormatAttribute(rawValue: 99), __C._CGLPixelFormatAttribute(rawValue: 12800), __C._CGLPixelFormatAttribute(rawValue: 73), __C._CGLPixelFormatAttribute(rawValue: 0)]
14:10:25.706 [iina][d] Falling back to nominal display refresh rate: 120.0 from 0.0
14:10:25.709 [iina][d] window!.screen: Built-in Retina Display visible frame (0.0, 44.0, 1728.0, 1035.0)
14:10:25.709 [iina][d] NSScreen.main: Built-in Retina Display visible frame (0.0, 44.0, 1728.0, 1035.0)
14:10:25.709 [iina][d] NSScreen.screens[0]: Built-in Retina Display visible frame (0.0, 44.0, 1728.0, 1035.0)
14:10:25.709 [iina][d] MainWindowLastPosition (0.0, 76.0) matched: Built-in Retina Display visible frame (0.0, 44.0, 1728.0, 1035.0)
14:10:25.711 [player0][d] File started
14:10:25.711 [player0][d] Track list changed
14:10:25.712 [player0][d] Started auto load
14:10:25.713 [fmatcher][d] **Start matching
14:10:25.713 [fmatcher][d] Getting all media files...
14:10:25.716 [player0][d] Track list changed
14:10:25.720 [player0][d] File loaded
14:10:25.726 [fmatcher][d] Got all media files, video=22, audio=0
14:10:25.727 [fmatcher][d] Getting all sub files...
14:10:25.728 [fmatcher][d] Searching subtitles from 5 directories...
14:10:25.733 [fmatcher][d] Got 9 subtitles
14:10:25.734 [fmatcher][d] Grouping video files...
14:10:25.734 [fgroup][d] Start grouping 22 files
14:10:25.735 [fmatcher][d] Finished with 1 groups
14:10:25.735 [fmatcher][d] Grouping sub files...
14:10:25.735 [fgroup][d] Start grouping 9 files
14:10:25.735 [fmatcher][d] Finished with 1 groups
14:10:25.735 [fmatcher][d] Matching video and sub series...
14:10:25.735 [fmatcher][d] Calculated editing distance
14:10:25.736 [fmatcher][d] Finished matching.
14:10:25.737 [fmatcher][d] Matching subs with matched series, prefixes=0...
14:10:25.737 [fmatcher][d] **Finished matching
14:10:25.755 [player0][d] Track list changed
14:10:25.827 [player0][d] Getting thumbnails
14:10:25.828 [player0][d] Found thumbnail cache
14:10:25.828 [thumbcache][d] Reading thumbnail cache...
14:10:25.828 [thumbcache][d] Reading from /Users/low-batt/Library/Caches/com.colliderli.iina/thumb_cache/5136587baff284aba811c3f47b084be6
14:10:25.829 [player0][d] Track list changed
14:10:25.830 [hdr][d] Will activate HDR color space instead of using ICC profile
14:10:25.839 [hdr][d] HDR mode has been enabled, skipping
14:10:25.859 [thumbcache][d] Finished reading thumbnail cache, 53 in total
14:10:27.613 [player0][d] Playback restarted
14:10:37.369 [iina][e] Return value -4 when executing key command {encode} quit 4
14:10:37.369 [iina][w] mpv log: [input] error: Command '{encode}' not found.
14:10:37.369 [iina][w] mpv log: [input] error: Command was defined at main.
14:10:42.980 [iina][d] App should terminate
14:10:42.980 [iina][d] Disabling all menus
14:10:42.981 [iina][d] Disabling remote commands
14:10:42.981 [iina][d] Closing all windows
14:10:42.983 [player0][d] Write watch later config
14:10:42.985 [player0][d] Stopping playback
14:10:43.017 [iina][d] Waiting for players to stop and shutdown
14:10:43.221 [hdr][d] HDR primaries and gamma not available
14:10:43.222 [hdr][d] HDR primaries and gamma not available
14:10:43.226 [player0][d] Playback has stopped
14:10:43.226 [player0][d] Shutting down
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x48)
    frame #0: 0x0000000103f1d418 libmpv.1.dylib`mpv_get_property + 16
  * frame #1: 0x0000000102813b08 IINA`MPVController.getDouble(name="time-pos", self=0x00006000031ad170) at MPVController.swift:578:5
    frame #2: 0x00000001027d1d70 IINA`PlayerCore.syncUI(option=time, self=0x0000600003cac3c0) at PlayerCore.swift:1576:40
    frame #3: 0x00000001027d1474 IINA`PlayerCore.syncUITime(self=0x0000600003cac3c0) at PlayerCore.swift:1559:7
    frame #4: 0x0000000102540a88 IINA`MainWindowController.showUI(self=0x000000012a863800) at MainWindowController.swift:1677:12
    frame #5: 0x0000000102538120 IINA`MainWindowController.windowDidExitFullScreen(notification=Foundation.Notification @ 0x000000016da2bb60, self=0x000000012a863800) at MainWindowController.swift:1281:5
    frame #6: 0x000000010253894c IINA`@objc MainWindowController.windowDidExitFullScreen(_:) at <compiler-generated>:0
    frame #7: 0x000000019fae258c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
    frame #8: 0x000000019fb80074 CoreFoundation`___CFXRegistrationPost_block_invoke + 88
    frame #9: 0x000000019fb7ffbc CoreFoundation`_CFXRegistrationPost + 440
    frame #10: 0x000000019fab3bac CoreFoundation`_CFXNotificationPost + 708
    frame #11: 0x00000001a09a072c Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 88
    frame #12: 0x00000001a37af398 AppKit`-[NSWindow(NSFullScreen) _didExitFullScreen] + 336
    frame #13: 0x00000001a35b70a8 AppKit`-[_NSExitFullScreenTransitionController _doAfterExitFullScreen] + 304
    frame #14: 0x00000001a35b7904 AppKit`-[_NSExitFullScreenTransitionController _doSucceededToExitFullScreen] + 712
    frame #15: 0x00000001a35b813c AppKit`__63-[_NSExitFullScreenTransitionController _performExitFullScreen]_block_invoke + 236
    frame #16: 0x000000019f77d670 libxpc.dylib`_xpc_connection_reply_callout + 124
    frame #17: 0x000000019f77d560 libxpc.dylib`_xpc_connection_call_reply_async + 88
    frame #18: 0x000000010361ea54 libdispatch.dylib`_dispatch_client_callout3 + 20
    frame #19: 0x0000000103644d04 libdispatch.dylib`_dispatch_mach_msg_async_reply_invoke + 400
    frame #20: 0x0000000103631cd8 libdispatch.dylib`_dispatch_main_queue_drain + 780
    frame #21: 0x00000001036319bc libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #22: 0x000000019fb2ed6c CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #23: 0x000000019faec7ec CoreFoundation`__CFRunLoopRun + 2036
    frame #24: 0x000000019faeb8a4 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #25: 0x00000001a915f3bc HIToolbox`RunCurrentEventLoopInMode + 292
    frame #26: 0x00000001a915f04c HIToolbox`ReceiveNextEventCommon + 236
    frame #27: 0x00000001a915ef48 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 72
    frame #28: 0x00000001a2d44630 AppKit`_DPSNextEvent + 632
    frame #29: 0x00000001a2d437c0 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
    frame #30: 0x00000001a2f663b0 AppKit`-[NSApplication _shouldTerminate] + 700
    frame #31: 0x00000001a2f58fb0 AppKit`-[NSApplication terminate:] + 612
    frame #32: 0x00000001a2eed2f0 AppKit`-[NSApplication(NSResponder) sendAction:to:from:] + 440
    frame #33: 0x00000001a2fb9998 AppKit`-[NSMenuItem _corePerformAction] + 336
    frame #34: 0x00000001a2fb9714 AppKit`-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 104
    frame #35: 0x00000001a2ff5710 AppKit`-[NSMenu performActionForItemAtIndex:] + 200
    frame #36: 0x00000001a2ff5630 AppKit`-[NSMenu _internalPerformActionForItemAtIndex:] + 76
    frame #37: 0x00000001a2ff5484 AppKit`-[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 108
    frame #38: 0x00000001a2fa1cdc AppKit`NSSLMMenuEventHandler + 640
    frame #39: 0x00000001a9137944 HIToolbox`DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1092
    frame #40: 0x00000001a9136dc4 HIToolbox`SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 356
    frame #41: 0x00000001a914cfd4 HIToolbox`SendEventToEventTarget + 40
    frame #42: 0x00000001a91ac6bc HIToolbox`SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 416
    frame #43: 0x00000001a91d0ee4 HIToolbox`SendMenuCommandWithContextAndModifiers + 56
    frame #44: 0x00000001a91d0e74 HIToolbox`SendMenuItemSelectedEvent + 352
    frame #45: 0x00000001a91d0ca0 HIToolbox`FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 100
    frame #46: 0x00000001a91d1660 HIToolbox`MenuSelectCore(MenuData*, Point, double, unsigned int, OpaqueMenuRef**, unsigned short*) + 560
    frame #47: 0x00000001a91d1380 HIToolbox`_HandleMenuSelection2 + 416
    frame #48: 0x00000001a2e970f4 AppKit`_NSHandleCarbonMenuEvent + 256
    frame #49: 0x00000001a2e96f18 AppKit`_DPSEventHandledByCarbon + 60
    frame #50: 0x00000001a2d43db8 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2256
    frame #51: 0x00000001a2d37bf0 AppKit`-[NSApplication run] + 464
    frame #52: 0x00000001a2d0f058 AppKit`NSApplicationMain + 880
    frame #53: 0x00000001025e4e18 IINA`main at AppDelegate.swift:24:7
    frame #54: 0x000000019f6e3e50 dyld`start + 2544
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x48)
    frame #0: 0x0000000103f1d418 libmpv.1.dylib`mpv_get_property + 16
  * frame #1: 0x0000000102813b08 IINA`MPVController.getDouble(name="time-pos", self=0x00006000031ad170) at MPVController.swift:578:5
    frame #2: 0x00000001027d1d70 IINA`PlayerCore.syncUI(option=time, self=0x0000600003cac3c0) at PlayerCore.swift:1576:40
    frame #3: 0x00000001027d1474 IINA`PlayerCore.syncUITime(self=0x0000600003cac3c0) at PlayerCore.swift:1559:7
    frame #4: 0x0000000102540a88 IINA`MainWindowController.showUI(self=0x000000012a863800) at MainWindowController.swift:1677:12
    frame #5: 0x0000000102538120 IINA`MainWindowController.windowDidExitFullScreen(notification=Foundation.Notification @ 0x000000016da2bb60, self=0x000000012a863800) at MainWindowController.swift:1281:5
    frame #6: 0x000000010253894c IINA`@objc MainWindowController.windowDidExitFullScreen(_:) at <compiler-generated>:0
    frame #7: 0x000000019fae258c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
    frame #8: 0x000000019fb80074 CoreFoundation`___CFXRegistrationPost_block_invoke + 88
    frame #9: 0x000000019fb7ffbc CoreFoundation`_CFXRegistrationPost + 440
    frame #10: 0x000000019fab3bac CoreFoundation`_CFXNotificationPost + 708
    frame #11: 0x00000001a09a072c Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 88
    frame #12: 0x00000001a37af398 AppKit`-[NSWindow(NSFullScreen) _didExitFullScreen] + 336
    frame #13: 0x00000001a35b70a8 AppKit`-[_NSExitFullScreenTransitionController _doAfterExitFullScreen] + 304
    frame #14: 0x00000001a35b7904 AppKit`-[_NSExitFullScreenTransitionController _doSucceededToExitFullScreen] + 712
    frame #15: 0x00000001a35b813c AppKit`__63-[_NSExitFullScreenTransitionController _performExitFullScreen]_block_invoke + 236
    frame #16: 0x000000019f77d670 libxpc.dylib`_xpc_connection_reply_callout + 124
    frame #17: 0x000000019f77d560 libxpc.dylib`_xpc_connection_call_reply_async + 88
    frame #18: 0x000000010361ea54 libdispatch.dylib`_dispatch_client_callout3 + 20
    frame #19: 0x0000000103644d04 libdispatch.dylib`_dispatch_mach_msg_async_reply_invoke + 400
    frame #20: 0x0000000103631cd8 libdispatch.dylib`_dispatch_main_queue_drain + 780
    frame #21: 0x00000001036319bc libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #22: 0x000000019fb2ed6c CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #23: 0x000000019faec7ec CoreFoundation`__CFRunLoopRun + 2036
    frame #24: 0x000000019faeb8a4 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #25: 0x00000001a915f3bc HIToolbox`RunCurrentEventLoopInMode + 292
    frame #26: 0x00000001a915f04c HIToolbox`ReceiveNextEventCommon + 236
    frame #27: 0x00000001a915ef48 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 72
    frame #28: 0x00000001a2d44630 AppKit`_DPSNextEvent + 632
    frame #29: 0x00000001a2d437c0 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
    frame #30: 0x00000001a2f663b0 AppKit`-[NSApplication _shouldTerminate] + 700
    frame #31: 0x00000001a2f58fb0 AppKit`-[NSApplication terminate:] + 612
    frame #32: 0x00000001a2eed2f0 AppKit`-[NSApplication(NSResponder) sendAction:to:from:] + 440
    frame #33: 0x00000001a2fb9998 AppKit`-[NSMenuItem _corePerformAction] + 336
    frame #34: 0x00000001a2fb9714 AppKit`-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 104
    frame #35: 0x00000001a2ff5710 AppKit`-[NSMenu performActionForItemAtIndex:] + 200
    frame #36: 0x00000001a2ff5630 AppKit`-[NSMenu _internalPerformActionForItemAtIndex:] + 76
    frame #37: 0x00000001a2ff5484 AppKit`-[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 108
    frame #38: 0x00000001a2fa1cdc AppKit`NSSLMMenuEventHandler + 640
    frame #39: 0x00000001a9137944 HIToolbox`DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1092
    frame #40: 0x00000001a9136dc4 HIToolbox`SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 356
    frame #41: 0x00000001a914cfd4 HIToolbox`SendEventToEventTarget + 40
    frame #42: 0x00000001a91ac6bc HIToolbox`SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 416
    frame #43: 0x00000001a91d0ee4 HIToolbox`SendMenuCommandWithContextAndModifiers + 56
    frame #44: 0x00000001a91d0e74 HIToolbox`SendMenuItemSelectedEvent + 352
    frame #45: 0x00000001a91d0ca0 HIToolbox`FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 100
    frame #46: 0x00000001a91d1660 HIToolbox`MenuSelectCore(MenuData*, Point, double, unsigned int, OpaqueMenuRef**, unsigned short*) + 560
    frame #47: 0x00000001a91d1380 HIToolbox`_HandleMenuSelection2 + 416
    frame #48: 0x00000001a2e970f4 AppKit`_NSHandleCarbonMenuEvent + 256
    frame #49: 0x00000001a2e96f18 AppKit`_DPSEventHandledByCarbon + 60
    frame #50: 0x00000001a2d43db8 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2256
    frame #51: 0x00000001a2d37bf0 AppKit`-[NSApplication run] + 464
    frame #52: 0x00000001a2d0f058 AppKit`NSApplicationMain + 880
    frame #53: 0x00000001025e4e18 IINA`main at AppDelegate.swift:24:7
    frame #54: 0x000000019f6e3e50 dyld`start + 2544
(lldb) 

Steps to reproduce:
Quit while playing a video in full screen. Use a script to do this over and over until the problem reproduces.

  • MPV does not have this problem.

How often does this happen?
Somewhat rare.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions