On Fri, 7 Nov 2025 15:33:42 GMT, Andy Goryachev <[email protected]> wrote:

>> No, it doesn't matter. 
>> 
>> The old screens are "disposed" just by setting their native pointer to 0L, 
>> so they can't be reused, while the new screens instances are passed to the 
>> windows, to keep an updated instance. 
>> 
>> Note that even if old screen and new screen have the very same information 
>> (nothing changed for this particular screen), since 
>> `WinWindow::notifyMoving` uses the equality operator (`screen 1 == screen 
>> 2`), we need to keep a valid instance in `Window::screen`, and therefore 
>> `Screen::dispose` is just a way of invalidating old instances. Then, since 
>> they are no longer referenced by any window, they can be gc'ed.
>
> I had exactly the same question, and looked into the implementation.
> Is it likely the implementation would change and the order be important in 
> the future?

I don't think so. And I would also argue that it would be weird, if not even 
bad if the order of disposing a `Screen` would matter

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1964#discussion_r2504214440

Reply via email to