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
Black windows on the other screens won’t disappear when exiting full screen #4683
Comments
Excellent report. I'm having trouble reproducing this. I'm wondering if the behavior of macOS has changed. I see this was reported against 14.1. I am running 14.1.1. Anyway, after almost giving up on reproducing this I am now looking at a black window on my external monitor. This is after I have quit IINA. To trigger the bad behavior I'm experiencing I had to unplug the external display and plug it back in while the Mac was asleep. @coin3x Are you experiencing the black window sticking around after IINA has terminated? Did this start happening after you upgraded to macOS Sonoma? @svobs Can you test this issue in your environment? In another issue under macOS 14.0 @svobs noticed hundreds of Now that I'm on Sonoma the I've not looked into this IINA feature before. Although some of this might be due to macOS Sonoma regressions, I'm thinking we need to review this code. I'm concerned about this: private func removeBlackWindow() {
Logger.log("removeBlackWindow")
for window in blackWindows {
window.orderOut(self)
}
blackWindows = []
} From the documentation for orderOut:
I'm not liking the "but does not cause it to be released" part. Does this mean we are leaking windows? I'm concerned about this as well: private func blackOutOtherMonitors() {
Logger.log("blackOutOtherMonitors")
screens = NSScreen.screens.filter { $0 != window?.screen }
Logger.log("blackWindows.count: \(blackWindows.count)")
blackWindows = []
for screen in screens {
var screenRect = screen.frame
screenRect.origin = CGPoint(x: 0, y: 0)
let blackWindow = NSWindow(contentRect: screenRect, styleMask: [], backing: .buffered, defer: false, screen: screen)
blackWindow.backgroundColor = .black
blackWindow.level = .iinaBlackScreen
blackWindows.append(blackWindow)
blackWindow.makeKeyAndOrderFront(nil)
}
} From the documentation for makeKeyAndOrderFront:
I believe that is triggering this error seen in the Xcode console:
From the documentation for canBecomeMain:
I've run out of time today to investigate further, but at the moment I'm thinking there may be multiple problems in this code. |
No, quitting IINA makes them go away.
It's been a while and I'm not sure.
They are deallocated after IINA exits full screen: Quartz Debug's Window List shows either zero (when not in full screen) or one black window after toggling full screen multiple times, unlike when the problem I'm reporting was triggered. I think as long as we don't keep references to them, it's fine. |
@low-batt Reproduced on 14.1.1. I went to full screen, kept my external display plugged in, but disconnected my power adapter, and then closed my MacBook's lid. Verified that the external display showed that it lost input. Then opened the lid again, entered my login info to unlock and then exited full screen. The black window was still there until I quit IINA. Also tried @coin3x's solution and it appears to have fixed the problem. It has been a couple of months since I dealt with this issue so my memory is fuzzy, but I do recall trying to deal with this, and the whole black window mechanism being kind of a headache. Strange that causing I also found an issue when running in legacy full screen and using an external tool (BetterTouchTool in my case) to move the video window to the next display, which ended up moving it behind the black window. This left me with one black display and one display showing the desktop. More of a fringe case I guess. I never experienced black windows lingering after IINA quit. That sounds pretty bad and implies something is wrong with MacOS.
I upgraded from MacOS 14.0 to 14.1.1 yesterday and am now seeing the same thing. Looks like a new one! |
@coin3x Before I forget again, extra THANKS for posting the patch containing the debug logging you were using. Very helpful. Another busy day, but I was able to investigate some more. I first tested this on my other MacBook Pro that is running macOS Ventura 13.6.1. The way I've been testing reproduced the problem reported in the issue. It did not reproduce after applying the proposed fix. I was unable to reproduce the behavior where the black window remains after IINA terminates. I went back to my MacBook Pro running macOS 14.1.1. I was finally able to reproduce the problem under the released version of IINA. Running under Xcode without the fix the behavior is not the same in the test case I'm running. The external monitor remains black after IINA has terminated. As if IINA has left a zombie window. To get rid of the window I have to unplug the external monitor and then plug it back in. The proposed fix also corrects this. I suspect we are experiencing defects in the latest version of AppKit available in macOS Sonoma. Building IINA with Xcode 15 allows use of this new version of AppKit. I suspect that is also behind the problem with the I will enter these other problems as separate issues to keep this issue focused solely on the black window behavior for which the posted PR fixes. |
@low-batt I know this is off-topic, but I noticed a pattern. For me, Open Recent stays populated across launches...of the same exact IINA binary. For example, I can launch my release copy of IINA 1.3.3 and everything works, but as soon as I launch my dev build, it gets blown away. In fact, I can relaunch the dev build and the recents are preserved, but if I make any changes which need a recompile, the recents are erased. This may be a hasty security fix which tries to couple the recent documents to the application's binary checksum or something along those lines. Because it's easy to conceive of an exploit which would allow a malignant app to read IINA's recent documents. Or...it may just be a bug. But it's easy to see why end users aren't reporting anything. |
That is concerning. At least it will also be fixed by this change. |
The fix for this issue has been merged into the IINA |
This has been fixed in IINA 1.3.4. Thanks @coin3x for the fix! |
System and IINA version:
Expected behavior:
Black windows on the other screens disappear when IINA exits full screen.
Actual behavior:
Black windows did not disappear.
Steps to reproduce:
Applying the following patch before reproducing the problem results in these log entries:
Patch
It appears that these events happened in sequence:
MainWindow
became main.The text was updated successfully, but these errors were encountered: