8000 Crash on open when previous position was on a now-disconnected display · Issue #3695 · iina/iina · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Crash on open when previous position was on a now-disconnected display #3695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
qtist opened this issue Apr 20, 2022 · 9 comments
Closed

Crash on open when previous position was on a now-disconnected display #3695

qtist opened this issue Apr 20, 2022 · 9 comments

Comments

@qtist
Copy link
qtist commented Apr 20, 2022

IINA generally lives on my secondary display. After using it in this state, when only one display is connected and I try to open a video, IINA will consistently crash every time (as if it tries to resume into a position that no longer exists). I must have done this 100 times now and keep forgetting to expect it. Recovery is simply opening the file again and it works as normal.

  • I'm using the "initial window size" setting, but not "initial window position"
  • Also using "use physical resolution on retina displays"
  • Machine is 14" M1 PRO
  • Main and secondary displays are both 4K using 2x scaling. Internal display is always off
@low-batt
Copy link
Contributor

Hello from another IINA user,

When an application crashes macOS usually creates a crash report. If the crash happened recently the report may still be available. Open /Applications/Utilities/Console. Look for an IINA crash report. Post the entire report here.

With computers there is a vast amount of complexity going on "under the hood". The computer industry works hard to hide this from users. But when a failure occurs. it is frequently necessary to dig into all the behind the scenes details to fully understand and correct the root cause of the problem. With respect to crashes, the crash report is a critical piece of evidence and required for diagnosing the problem.

@qtist
Copy link
Author
qtist commented Apr 20, 2022

Apologies, I hoped that someone who had worked in the area may have quickly recognised this as an unhandled case or something. Here is the latest crash report:

{
  "uptime" : 60000,
  "procLaunch" : "2022-04-18 11:15:33.9174 +0100",
  "procRole" : "Foreground",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro18,3",
  "procStartAbsTime" : 89782995429,
  "coalitionID" : 1549,
  "osVersion" : {
    "train" : "macOS 12.1",
    "build" : "21C52",
    "releaseType" : "User"
  },
  "captureTime" : "2022-04-20 13:23:30.8612 +0100",
  "incident" : "F1CAB947-5141-41DA-A27F-5D756A87ACC8",
  "bug_type" : "309",
  "pid" : 4044,
  "procExitAbsTime" : 1450685700670,
  "translated" : false,
  "cpuType" : "ARM-64",
  "procName" : "IINA",
  "procPath" : "\/Applications\/IINA.app\/Contents\/MacOS\/IINA",
  "bundleInfo" : {"CFBundleShortVersionString":"1.2.0","CFBundleVersion":"129","CFBundleIdentifier":"com.colliderli.iina"},
  "storeInfo" : {"deviceIdentifierForVendor":"21A86827-1111-5DE7-8051-3312992F4661","thirdParty":true},
  "parentProc" : "launchd",
  "parentPid" : 1,
  "coalitionName" : "com.colliderli.iina",
  "crashReporterKey" : "A3C865CD-A582-6743-DA0F-B013A182F262",
  "wakeTime" : 14457,
  "sleepWakeUUID" : "3E61D5B5-349C-417C-82CE-70D67613BBC8",
  "sip" : "enabled",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000001, 0x0000000100f42b50","rawCodes":[1,4310969168],"type":"EXC_BREAKPOINT","signal":"SIGTRAP"},
  "termination" : {"flags":0,"code":5,"namespace":"SIGNAL","indicator":"Trace\/BPT trap: 5","byProc":"exc handler","byPid":4044},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":54645,"threadState":{"x":[{"value":5368194496},{"value":8121451471,"objc-selector":"release"},{"value":8394301248},{"value":1},{"value":33},{"value":0},{"value":0},{"value":0},{"value":1073741824},{"value":2},{"value":1},{"value":5368194512},{"value":2},{"value":5369810656},{"value":897851392},{"value":105553161559088},{"value":105553161559088},{"value":17256667879097463224,"symbolLocation":17256667872176898048,"symbol":"-[NSResponder release]"},{"value":4551189740},{"value":0},{"value":4966326272},{"value":5368194496},{"value":105553153198848},{"value":0},{"value":104},{"value":6156422848},{"value":4312461312},{"value":8383012080,"symbolLocation":0,"symbol":"type metadata for URL"},{"value":144}],"flavor":"ARM_THREAD_STATE64","lr":{"value":10613717688628029052},"cpsr":{"value":1610616832},"fp":{"value":6156422832},"sp":{"value":6156422560},"esr":{"value":4060086273,"description":"(Breakpoint) brk 1"},"pc":{"value":4310969168,"matchesCrashFrame":1},"far":{"value":5378924928}},"queue":"com.apple.main-thread","frames":[{"imageOffset":518992,"symbol":"MainWindowController.windowWillOpen()","symbolLocation":1348,"imageIndex":0},{"imageOffset":517756,"symbol":"MainWindowController.windowWillOpen()","symbolLocation":112,"imageIndex":0},{"imageOffset":1202724,"symbol":"PlayerCore.openMainWindow(path:url:isNetwork:)","symbolLocation":808,"imageIndex":0},{"imageOffset":1199128,"symbol":"PlayerCore.open(_:shouldAutoLoad:)","symbolLocation":564,"imageIndex":0},{"imageOffset":1200132,"symbol":"PlayerCore.openURLs(_:shouldAutoLoad:)","symbolLocation":948,"imageIndex":0},{"imageOffset":721208,"symbol":"AppDelegate.handleOpenFile()","symbolLocation":568,"imageIndex":0},{"imageOffset":721360,"symbol":"@objc AppDelegate.handleOpenFile()","symbolLocation":28,"imageIndex":0},{"imageOffset":680604,"symbol":"__NSFireTimer","symbolLocation":104,"imageIndex":1},{"imageOffset":652392,"symbol":"__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__","symbolLocation":32,"imageIndex":2},{"imageOffset":651364,"symbol":"__CFRunLoopDoTimer","symbolLocation":1076,"imageIndex":2},{"imageOffset":649968,"symbol":"__CFRunLoopDoTimers","symbolLocation":392,"imageIndex":2},{"imageOffset":538220,"symbol":"__CFRunLoopRun","symbolLocation":1944,"imageIndex":2},{"imageOffset":534324,"symbol":"CFRunLoopRunSpecific","symbolLocation":600,"imageIndex":2},{"imageOffset":208744,"symbol":"RunCurrentEventLoopInMode","symbolLocation":292,"imageIndex":3},{"imageOffset":208092,"symbol":"ReceiveNextEventCommon","symbolLocation":552,"imageIndex":3},{"imageOffset":207516,"symbol":"_BlockUntilNextEventMatchingListInModeWithFilter","symbolLocation":72,"imageIndex":3},{"imageOffset":269536,"symbol":"_DPSNextEvent","symbolLocation":844,"imageIndex":4},{"imageOffset":263556,"symbol":"-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]","symbolLocation":1332,"imageIndex":4},{"imageOffset":206244,"symbol":"-[NSApplication run]","symbolLocation":596,"imageIndex":4},{"imageOffset":15480,"symbol":"NSApplicationMain","symbolLocation":1064,"imageIndex":4},{"imageOffset":39280,"symbol":"main","symbolLocation":12,"imageIndex":0},{"imageOffset":20724,"symbol":"start","symbolLocation":520,"imageIndex":5}]},{"id":54680,"name":"mpv\/mpv core","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":376464,"symbol":"mp_dispatch_queue_process","symbolLocation":300,"imageIndex":8},{"imageOffset":598708,"symbol":"mp_wait_events","symbolLocation":80,"imageIndex":8},{"imageOffset":609612,"symbol":"mp_idle","symbolLocation":100,"imageIndex":8},{"imageOffset":609720,"symbol":"idle_loop","symbolLocation":44,"imageIndex":8},{"imageOffset":564116,"symbol":"mp_play_files","symbolLocation":588,"imageIndex":8},{"imageOffset":466440,"symbol":"core_thread","symbolLocation":72,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54681,"name":"mpv\/lua script (ytdl_hook)","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":464496,"symbol":"wait_wakeup","symbolLocation":88,"imageIndex":8},{"imageOffset":466924,"symbol":"mpv_wait_event","symbolLocation":392,"imageIndex":8},{"imageOffset":577288,"symbol":"script_raw_wait_event","symbolLocation":108,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":576328,"symbol":"script_autofree_trampoline","symbolLocation":128,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":78900,"symbol":"luaV_execute","symbolLocation":2596,"imageIndex":9},{"imageOffset":39256,"symbol":"luaD_call","symbolLocation":120,"imageIndex":9},{"imageOffset":23544,"symbol":"lua_call","symbolLocation":36,"imageIndex":9},{"imageOffset":576016,"symbol":"load_scripts","symbolLocation":376,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":574280,"symbol":"run_lua","symbolLocation":956,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23816,"symbol":"lua_cpcall","symbolLocation":48,"imageIndex":9},{"imageOffset":573016,"symbol":"load_lua","symbolLocation":276,"imageIndex":8},{"imageOffset":617468,"symbol":"run_script","symbolLocation":100,"imageIndex":8},{"imageOffset":617600,"symbol":"script_thread","symbolLocation":32,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54682,"name":"mpv\/lua script (stats)","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":464496,"symbol":"wait_wakeup","symbolLocation":88,"imageIndex":8},{"imageOffset":466924,"symbol":"mpv_wait_event","symbolLocation":392,"imageIndex":8},{"imageOffset":577288,"symbol":"script_raw_wait_event","symbolLocation":108,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":576328,"symbol":"script_autofree_trampoline","symbolLocation":128,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":78900,"symbol":"luaV_execute","symbolLocation":2596,"imageIndex":9},{"imageOffset":39256,"symbol":"luaD_call","symbolLocation":120,"imageIndex":9},{"imageOffset":23544,"symbol":"lua_call","symbolLocation":36,"imageIndex":9},{"imageOffset":576016,"symbol":"load_scripts","symbolLocation":376,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":574280,"symbol":"run_lua","symbolLocation":956,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23816,"symbol":"lua_cpcall","symbolLocation":48,"imageIndex":9},{"imageOffset":573016,"symbol":"load_lua","symbolLocation":276,"imageIndex":8},{"imageOffset":617468,"symbol":"run_script","symbolLocation":100,"imageIndex":8},{"imageOffset":617600,"symbol":"script_thread","symbolLocation":32,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54683,"name":"mpv\/lua script (console)","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":464496,"symbol":"wait_wakeup","symbolLocation":88,"imageIndex":8},{"imageOffset":466924,"symbol":"mpv_wait_event","symbolLocation":392,"imageIndex":8},{"imageOffset":577288,"symbol":"script_raw_wait_event","symbolLocation":108,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":576328,"symbol":"script_autofree_trampoline","symbolLocation":128,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":78900,"symbol":"luaV_execute","symbolLocation":2596,"imageIndex":9},{"imageOffset":39256,"symbol":"luaD_call","symbolLocation":120,"imageIndex":9},{"imageOffset":23544,"symbol":"lua_call","symbolLocation":36,"imageIndex":9},{"imageOffset":576016,"symbol":"load_scripts","symbolLocation":376,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":574280,"symbol":"run_lua","symbolLocation":956,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23816,"symbol":"lua_cpcall","symbolLocation":48,"imageIndex":9},{"imageOffset":573016,"symbol":"load_lua","symbolLocation":276,"imageIndex":8},{"imageOffset":617468,"symbol":"run_script","symbolLocation":100,"imageIndex":8},{"imageOffset":617600,"symbol":"script_thread","symbolLocation":32,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54685,"name":"AMCP Logging Spool","frames":[{"imageOffset":6544,"symbol":"semaphore_wait_trap","symbolLocation":8,"imageIndex":6},{"imageOffset":129196,"symbol":"caulk::mach::semaphore::wait_or_error()","symbolLocation":28,"imageIndex":10},{"imageOffset":9820,"symbol":"caulk::concurrent::details::worker_thread::run()","symbolLocation":56,"imageIndex":10},{"imageOffset":8828,"symbol":"void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*)","symbolLocation":96,"imageIndex":10},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54704,"name":"com.apple.NSEventThread","frames":[{"imageOffset":6484,"symbol":"mach_msg_trap","symbolLocation":8,"imageIndex":6},{"imageOffset":7424,"symbol":"mach_msg","symbolLocation":76,"imageIndex":6},{"imageOffset":544472,"symbol":"__CFRunLoopServiceMachPort","symbolLocation":372,"imageIndex":2},{"imageOffset":537488,"symbol":"__CFRunLoopRun","symbolLocation":1212,"imageIndex":2},{"imageOffset":534324,"symbol":"CFRunLoopRunSpecific","symbolLocation":600,"imageIndex":2},{"imageOffset":1764496,"symbol":"_NSEventThread","symbolLocation":196,"imageIndex":4},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54712,"name":"mpv\/worker","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":383212,"symbol":"worker_thread","symbolLocation":88,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54969,"name":"mpv\/mpv core","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":376464,"symbol":"mp_dispatch_queue_process","symbolLocation":300,"imageIndex":8},{"imageOffset":598708,"symbol":"mp_wait_events","symbolLocation":80,"imageIndex":8},{"imageOffset":609612,"symbol":"mp_idle","symbolLocation":100,"imageIndex":8},{"imageOffset":609720,"symbol":"idle_loop","symbolLocation":44,"imageIndex":8},{"imageOffset":564116,"symbol":"mp_play_files","symbolLocation":588,"imageIndex":8},{"imageOffset":466440,"symbol":"core_thread","symbolLocation":72,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54970,"name":"mpv\/lua script (ytdl_hook)","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":464496,"symbol":"wait_wakeup","symbolLocation":88,"imageIndex":8},{"imageOffset":466924,"symbol":"mpv_wait_event","symbolLocation":392,"imageIndex":8},{"imageOffset":577288,"symbol":"script_raw_wait_event","symbolLocation":108,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":576328,"symbol":"script_autofree_trampoline","symbolLocation":128,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":78900,"symbol":"luaV_execute","symbolLocation":2596,"imageIndex":9},{"imageOffset":39256,"symbol":"luaD_call","symbolLocation":120,"imageIndex":9},{"imageOffset":23544,"symbol":"lua_call","symbolLocation":36,"imageIndex":9},{"imageOffset":576016,"symbol":"load_scripts","symbolLocation":376,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":574280,"symbol":"run_lua","symbolLocation":956,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23816,"symbol":"lua_cpcall","symbolLocation":48,"imageIndex":9},{"imageOffset":573016,"symbol":"load_lua","symbolLocation":276,"imageIndex":8},{"imageOffset":617468,"symbol":"run_script","symbolLocation":100,"imageIndex":8},{"imageOffset":617600,"symbol":"script_thread","symbolLocation":32,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54971,"name":"mpv\/lua script (stats)","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":464496,"symbol":"wait_wakeup","symbolLocation":88,"imageIndex":8},{"imageOffset":466924,"symbol":"mpv_wait_event","symbolLocation":392,"imageIndex":8},{"imageOffset":577288,"symbol":"script_raw_wait_event","symbolLocation":108,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":576328,"symbol":"script_autofree_trampoline","symbolLocation":128,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":78900,"symbol":"luaV_execute","symbolLocation":2596,"imageIndex":9},{"imageOffset":39256,"symbol":"luaD_call","symbolLocation":120,"imageIndex":9},{"imageOffset":23544,"symbol":"lua_call","symbolLocation":36,"imageIndex":9},{"imageOffset":576016,"symbol":"load_scripts","symbolLocation":376,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":574280,"symbol":"run_lua","symbolLocation":956,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23816,"symbol":"lua_cpcall","symbolLocation":48,"imageIndex":9},{"imageOffset":573016,"symbol":"load_lua","symbolLocation":276,"imageIndex":8},{"imageOffset":617468,"symbol":"run_script","symbolLocation":100,"imageIndex":8},{"imageOffset":617600,"symbol":"script_thread","symbolLocation":32,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54972,"name":"mpv\/lua script (console)","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":464496,"symbol":"wait_wakeup","symbolLocation":88,"imageIndex":8},{"imageOffset":466924,"symbol":"mpv_wait_event","symbolLocation":392,"imageIndex":8},{"imageOffset":577288,"symbol":"script_raw_wait_event","symbolLocation":108,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":576328,"symbol":"script_autofree_trampoline","symbolLocation":128,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":78900,"symbol":"luaV_execute","symbolLocation":2596,"imageIndex":9},{"imageOffset":39256,"symbol":"luaD_call","symbolLocation":120,"imageIndex":9},{"imageOffset":23544,"symbol":"lua_call","symbolLocation":36,"imageIndex":9},{"imageOffset":576016,"symbol":"load_scripts","symbolLocation":376,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23700,"symbol":"lua_pcall","symbolLocation":112,"imageIndex":9},{"imageOffset":574280,"symbol":"run_lua","symbolLocation":956,"imageIndex":8},{"imageOffset":38288,"symbol":"luaD_precall","symbolLocation":728,"imageIndex":9},{"imageOffset":39240,"symbol":"luaD_call","symbolLocation":104,"imageIndex":9},{"imageOffset":36828,"symbol":"luaD_rawrunprotected","symbolLocation":76,"imageIndex":9},{"imageOffset":39980,"symbol":"luaD_pcall","symbolLocation":60,"imageIndex":9},{"imageOffset":23816,"symbol":"lua_cpcall","symbolLocation":48,"imageIndex":9},{"imageOffset":573016,"symbol":"load_lua","symbolLocation":276,"imageIndex":8},{"imageOffset":617468,"symbol":"run_script","symbolLocation":100,"imageIndex":8},{"imageOffset":617600,"symbol":"script_thread","symbolLocation":32,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":54980,"name":"mpv\/worker","frames":[{"imageOffset":20672,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":6},{"imageOffset":30728,"symbol":"_pthread_cond_wait","symbolLocation":1228,"imageIndex":7},{"imageOffset":383212,"symbol":"worker_thread","symbolLocation":88,"imageIndex":8},{"imageOffset":29248,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8228,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]},{"id":731553,"frames":[{"imageOffset":8208,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":7}]},{"id":742990,"frames":[{"imageOffset":8208,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":7}]},{"id":753110,"frames":[{"imageOffset":8208,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":7}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4310450176,
    "CFBundleShortVersionString" : "1.2.0",
    "CFBundleIdentifier" : "com.colliderli.iina",
    "size" : 1851392,
    "uuid" : "cb0ad903-780e-3761-97a3-a2cdd353ea16",
    "path" : "\/Applications\/IINA.app\/Contents\/MacOS\/IINA",
    "name" : "IINA",
    "CFBundleVersion" : "129"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6890487808,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.Foundation",
    "size" : 4120576,
    "uuid" : "cd7cdf11-986e-3754-8011-e628c3be8380",
    "path" : "\/System\/Library\/Frameworks\/Foundation.framework\/Versions\/C\/Foundation",
    "name" : "Foundation",
    "CFBundleVersion" : "1856.105"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6874808320,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.CoreFoundation",
    "size" : 5521408,
    "uuid" : "f5ea9592-4ef9-3d35-b23d-5c21283acc52",
    "path" : "\/System\/Library\/Frameworks\/CoreFoundation.framework\/Versions\/A\/CoreFoundation",
    "name" : "CoreFoundation",
    "CFBundleVersion" : "1856.105"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7021486080,
    "CFBundleShortVersionString" : "2.1.1",
    "CFBundleIdentifier" : "com.apple.HIToolbox",
    "size" : 3342336,
    "uuid" : "01b981b8-a2d8-374d-9a0e-c4ac8c1009da",
    "path" : "\/System\/Library\/Frameworks\/Carbon.framework\/Versions\/A\/Frameworks\/HIToolbox.framework\/Versions\/A\/HIToolbox",
    "name" : "HIToolbox"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 692051
8000
5584,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.AppKit",
    "size" : 15417344,
    "uuid" : "a8bbc643-113d-310f-96b6-77a973bf2dba",
    "path" : "\/System\/Library\/Frameworks\/AppKit.framework\/Versions\/C\/AppKit",
    "name" : "AppKit",
    "CFBundleVersion" : "2113.20.111"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 4319805440,
    "size" : 393216,
    "uuid" : "7e92b284-4b90-3b68-b31a-3ddc4c0e8d40",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6874267648,
    "size" : 221184,
    "uuid" : "c8b3081a-5081-3a99-bbe3-01413de444c6",
    "path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
    "name" : "libsystem_kernel.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6874488832,
    "size" : 53248,
    "uuid" : "ed328b18-eeef-3b15-8858-798b19b0c2cd",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4361584640,
    "size" : 2965504,
    "uuid" : "a484fb47-91da-3294-9c91-82bcc566d154",
    "path" : "\/Applications\/IINA.app\/Contents\/Frameworks\/libmpv.1.dylib",
    "name" : "libmpv.1.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4340989952,
    "size" : 131072,
    "uuid" : "22e0e246-4fca-362d-aec2-f887a557d21d",
    "path" : "\/Applications\/IINA.app\/Contents\/Frameworks\/liblua.5.1.dylib",
    "name" : "liblua.5.1.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7018885120,
    "CFBundleShortVersionString" : "1.0",
    "CFBundleIdentifier" : "com.apple.audio.caulk",
    "size" : 163840,
    "uuid" : "37a561f9-46f0-37fe-811b-894385645aed",
    "path" : "\/System\/Library\/PrivateFrameworks\/caulk.framework\/Versions\/A\/caulk",
    "name" : "caulk"
  }
],
  "sharedCache" : {
  "base" : 6871318528,
  "size" : 3089596416,
  "uuid" : "66c33c62-48a9-31e5-b8b5-7a71c9760d07"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=1.1G resident=0K(0%) swapped_out_or_unallocated=1.1G(100%)\nWritable regions: Total=2.8G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=2.8G(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nAccelerate framework              1920K       15 \nActivity Tracing                   256K        1 \nCG backing stores                 8640K       12 \nCG image                          2592K       82 \nCG raster data                    25.2M      202 \nColorSync                          592K       29 \nCoreAnimation                     24.8M      552 \nCoreGraphics                       128K        8 \nCoreImage                           64K        4 \nCoreUI image data                 6656K       60 \nFoundation                          48K        2 \nImage IO                            16K        1 \nKernel Alloc Once                   32K        1 \nMALLOC                             2.1G      245 \nMALLOC guard page                  192K       10 \nMALLOC_MEDIUM (reserved)         608.0M        7         reserved VM address space (unallocated)\nOpenGL GLSL                        384K        5 \nSTACK GUARD                       56.2M       16 \nStack                             16.0M       16 \nVM_ALLOCATE                        784K       43 \n__AUTH                            2552K      311 \n__AUTH_CONST                      19.7M      499 \n__DATA                            26.8M      561 \n__DATA_CONST                      20.0M      570 \n__DATA_DIRTY                      1782K      209 \n__FONT_DATA                          4K        1 \n__GLSLBUILTINS                    5176K        1 \n__LINKEDIT                       586.1M       70 \n__OBJC_CONST                      3537K      270 \n__OBJC_RO                         82.0M        1 \n__OBJC_RW                         3104K        1 \n__TEXT                           513.4M      588 \n__UNICODE                          588K        1 \ndyld private memory               1024K        1 \nmapped file                      363.3M       30 \nshared memory                      960K       19 \n===========                     =======  ======= \nTOTAL                              4.4G     4444 \nTOTAL, minus reserved VM space     3.8G     4444 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "60da5e84ab0ca017dace9abf",
      "factorPackIds" : {

      },
      "deploymentId" : 240000008
    },
    {
      "rolloutId" : "607844aa04477260f58a8077",
      "factorPackIds" : {
        "SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
      },
      "deploymentId" : 240000066
    },
    {
      "rolloutId" : "602ad4dac86151000cf27e46",
      "factorPackIds" : {
        "SIRI_DICTATION_ASSETS" : "61fb0e87c773c43cde3bb80e"
      },
      "deploymentId" : 240000305
    },
    {
      "rolloutId" : "60356660bbe37970735c5624",
      "factorPackIds" : {

      },
      "deploymentId" : 240000027
    },
    {
      "rolloutId" : "601d9415f79519000ccd4b69",
      "factorPackIds" : {
        "SIRI_TEXT_TO_SPEECH" : "621d4d0f680160486b9e1c98"
      },
      "deploymentId" : 240000414
    },
    {
      "rolloutId" : "5fb4245a1bbfe8005e33a1e1",
      "factorPackIds" : {

      },
      "deploymentId" : 240000015
    },
    {
      "rolloutId" : "5fc94383418129005b4e9ae0",
      "factorPackIds" : {

      },
      "deploymentId" : 240000334
    },
    {
      "rolloutId" : "5ffde50ce2aacd000d47a95f",
      "factorPackIds" : {

      },
      "deploymentId" : 240000136
    }
  ],
  "experiments" : [

  ]
}
}

@low-batt
Copy link
Contributor

No need to apologize. I'm happy when people take the time to report problems. Thanks for posting the crash report.

The crash report shows the crash occurred here:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   IINA                          	       0x100f42b50 MainWindowController.windowWillOpen() + 1348

Something in this code failed:

  func windowWillOpen() {
    var screen = window!.screen!

    if let rectString = UserDefaults.standard.value(forKey: "MainWindowLastPosition") as? String {
      let rect = NSRectFromString(rectString)
      if let lastScreen = NSScreen.screens.first(where: { NSPointInRect(rect.origin, $0.visibleFrame) }) {
        screen = lastScreen
      }
    }

    if shouldApplyInitialWindowSize, let wfg = windowFrameFromGeometry(newSize: AppData.sizeWhenNoVideo, screen: screen) {
      window!.setFrame(wfg, display: true)
    } else {
      window!.setFrame(AppData.sizeWhenNoVideo.centeredRect(in: screen.visibleFrame), display: true)
    }

    videoView.videoLayer.draw(forced: true)
  }

Notice the reference to "MainWindowLastPosition" and the references to screens. This code is definitely involved in exactly what is described in your problem report, remembering the previous window position.

I tried reproducing the crash. I didn't trigger a crash, but I definitely put IINA into a bad state:

2022-04-20 22:39:53.706807-0400 IINA[42399:4303243] [default] invalid display identifier E38F6C1F-0BB4-4054-BFA3-691358E5FE0F

Definitely something is broken in the code.

I don't remember seeing an IINA issue with a similar crash. I do remember something about issues with multiple monitors.

Late here, brain slowing down. I will try and find time to take another look at this tomorrow when I'm more awake.

Although I'm just another IINA user I am a software engineer and have been investigating some IINA problems and submitting proposed fixes. I will see if I can figure out what is going on in this case.

@low-batt
Copy link
Contributor

Reproduced crash. Continuing to investigate.

low-batt added a commit to low-batt/iina that referenced this issue Apr 23, 2022
The commit in the pull request will:
- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:
 - window!.screen: The screen where most of the window is on; it is
   nil when the window is offscreen.
 - NSScreen.main: The screen containing the window that is currently
   receiving keyboard events.
 - NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil.  If that is encountered the method will fall
back to using the primary screen.
@low-batt
Copy link
Contributor

Reproducing

  • Ensure the preference Keep window open after playback finishes is enabled
  • Attach an external monitor to your Mac
  • Open a video file with IINA
  • If the IINA window is not on the external monitor move it to that monitor
  • Close the IINA window (IINA should remain running)
  • Unplug the external monitor
  • Open a video file with IINA
  • IINA crashes

Analysis

IINA is crashing on the first statement in MainWindowController.windowWillOpen:

  func windowWillOpen() {
    var screen = window!.screen!

Running in Xcode the console shows:

2022-04-21 23:03:14.346440-0400 IINA[92346:4642284] IINA/MainWindowController.swift:988: Fatal error: Unexpectedly found nil while unwrapping an Optional value

The documentation of the NSWindow.screen property says:

The value of this property is the screen where most of the window is on; it is nil when the window is offscreen.

PlayerCore caches and reuses players along with their windows. This is an Apple recommended practice. The result is that the NSWindow.screen property that was referring to the screen on the external monitor has been set to nil now that the monitor is no longer connected.

This explains the crash reported in the issue.

Unfortunately while testing I encountered another problem. None of the IINA menus would respond after disconnecting the external monitor. These messages would pour out in Xcode console when touching the IINA menus:

2022-04-20 23:47:49.907801-0400 IINA[42399:4359874] [] [0x15312b620] Bad CurrentVBLDelta for display 4 is zero. defaulting to 60Hz.
2022-04-20 23:47:49.924463-0400 IINA[42399:4359874] [] CurrentVBLDelta returned 0 for display 4 -- ignoring unreasonable value

I found this error being discussed in this post in the Apple Developer Forums: Sudden error being logged continuously in XCode console

It is sounding like this is a regression added in macOS Monterey, maybe starting with 12.2. Troubling.

Fixing

The commit in the pull request will:

  • Add a new method selectDefaultScreen to MainWindowController that selects the screen to use as the default for a window
  • Add a new method logScreen to MainWindowController for screen related log messages
  • Change windowWillOpen to log information about screen selection
  • Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen to use in this order:

  • window!.screen The screen where most of the window is on; it is nil when the window is offscreen.
  • NSScreen.main The screen containing the window that is currently receiving keyboard events.
  • NSScreeen.screens[0] The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall back to using the main screen. Apple documentation is silent concerning when NSScreen.main is nil. If that is encountered the method will fall back to using the primary screen.

Example of log messages testing the failing scenario:

21:02:45.737 [iina][d] window!.screen: nil
21:02:45.737 [iina][d] NSScreen.main: Built-in Retina Display visible frame (0.0, 27.0, 1728.0, 1052.0)
21:02:45.737 [iina][d] NSScreen.screens[0]: Built-in Retina Display visible frame (0.0, 27.0, 1728.0, 1052.0)

Example of log messages when running on an external monitor:

21:02:24.438 [iina][d] window!.screen: LG UltraFine visible frame (0.0, 0.0, 2560.0, 1415.0)
21:02:24.438 [iina][d] NSScreen.main: LG UltraFine visible frame (0.0, 0.0, 2560.0, 1415.0)
21:02:24.438 [iina][d] NSScreen.screens[0]: LG UltraFine visible frame (0.0, 0.0, 2560.0, 1415.0)
21:02:24.438 [iina][d] NSScreen.screens[1]: Built-in Retina Display visible frame (455.0, -1090.0, 1728.0, 1052.0)
21:02:24.438 [iina][d] MainWindowLastPosition (1137.0, 643.0) matched: LG UltraFine visible frame (0.0, 0.0, 2560.0, 1415.0)

@low-batt
Copy link
Contributor

@qtist Thanks again for reporting this problem! Definitely an important one to fix.

low-batt added a commit to CarterLi/iina that referenced this issue Apr 23, 2022
This commit will:

- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
@qtist
Copy link
Author
qtist commented Apr 23, 2022

No problem, great work @low-batt!

CarterLi pushed a commit to CarterLi/iina that referenced this issue Apr 23, 2022
This commit will:

- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
low-batt added a commit to CarterLi/iina that referenced this issue Apr 23, 2022
This commit will:

- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
low-batt added a commit to CarterLi/iina that referenced this issue Apr 24, 2022
This commit will:

- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
low-batt added a commit to CarterLi/iina that referenced this issue Apr 27, 2022
This commit will:

- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
CarterLi pushed a commit to CarterLi/iina that referenced this issue Apr 28, 2022
This commit will:

- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
low-batt added a commit to CarterLi/iina that referenced this issue May 1, 2022
This commit will:

- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
low-batt added a commit to low-batt/iina that referenced this issue May 3, 2022
The commit in the pull request will:
- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:
 - window!.screen: The screen where most of the window is on; it is
   nil when the window is offscreen.
 - NSScreen.main: The screen containing the window that is currently
   receiving keyboard events.
 - NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil.  If that is encountered the method will fall
back to using the primary screen.
low-batt added a commit to low-batt/iina that referenced this issue May 3, 2022
Rebased and corrected merge conflicts and addressed review
comments.

The commit in the pull request will:

 - Add a new method selectDefaultScreen to Extensions.NSWindow
   that selects the screen to use as the default for a window
 - Add a new method log to Extensions.NSScreen for screen
   related log messages
 - Change windowWillOpen to log information about screen selection
 - Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
CarterLi pushed a commit to CarterLi/iina that referenced this issue May 5, 2022
This commit will:

- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
lhc70000 pushed a commit that referenced this issue May 5, 2022
* Fix crash on open when external display disconnected, #3695

The commit in the pull request will:
- Add a new method selectDefaultScreen to MainWindowController that
  selects the screen to use as the default for a window
- Add a new method logScreen to MainWindowController for screen
  related log messages
- Change windowWillOpen to log information about screen selection
- Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:
 - window!.screen: The screen where most of the window is on; it is
   nil when the window is offscreen.
 - NSScreen.main: The screen containing the window that is currently
   receiving keyboard events.
 - NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil.  If that is encountered the method will fall
back to using the primary screen.

* Fix crash on open when external display disconnected, #3695

Rebased and corrected merge conflicts and addressed review
comments.

The commit in the pull request will:

 - Add a new method selectDefaultScreen to Extensions.NSWindow
   that selects the screen to use as the default for a window
 - Add a new method log to Extensions.NSScreen for screen
   related log messages
 - Change windowWillOpen to log information about screen selection
 - Change windowWillOpen to use selectDefaultScreen

The new selectDefaultScreen method searches for a screen in this order:

- window!.screen: The screen where most of the window is on; it is
  nil when the window is offscreen.
- NSScreen.main: The screen containing the window that is currently
  receiving keyboard events.
- NSScreeen.screens[0]: The primary screen of the user’s system.

If the screen associated with the window is nil this method will fall
back to using the main screen. Apple documentation is silent concerning
when NSScreen.main is nil. If that is encountered the method will fall
back to using the primary screen.
@low-batt
Copy link
Contributor
low-batt commented May 6, 2022

The fix in PR #3698 has been merged into the develop branch.

@low-batt
Copy link
Contributor

Closing. Fixed in IINA 1.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0