On Fri, 16 Feb 2024 21:50:09 GMT, Phil Race <p...@openjdk.org> wrote:

> The first thing I worry about here is that the obvious implication is that we 
> can now have zero monitors. Even if the monitor were not usable, that seems 
> to have been "OK" in practice so long as we didn't assert out in a debug 
> build. Have you looked for any subsequent code that might break with zero 
> monitors ?

I think that's hard to find out. At least our regression testing did not show 
issues. The change probably needs more testing. On the other hand, I think the 
risk with that change is low since the environment that is addressed by it 
seems to be rather unusual and the asserts show that something goes wrong in 
that case currently anyway.

> The 2nd thing is that this situation ought to clearly flag that this is a 
> HEADLESS situation and the AWT should be in headless mode. And that decision 
> usually needs to be made very early. So is this code path involved in that 
> decision. It seems likely there's a missing piece since I don't know that we 
> even properly make that decision on windows like we do on Linux.

That's a valid point. We could flag a system where we detect zero monitors as 
headless and then set the headless property. At the moment the default headless 
property would be false on Windows in any case, as per 
[here](https://github.com/openjdk/jdk/blob/f365d807e5552a6ad9a36afd82db8f0881d62cc3/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java#L41).
 I guess we can wire the monitor detection in here and return true if no 
monitors were found. Would you want me to go that way?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17614#issuecomment-1959528168

Reply via email to