On Tue, 2 Mar 2021 23:21:49 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

> > Should `frame` be declared as `volatile`? It's accessed on main thread in 
> > finally block.
> > In addition to it, `frame.getBounds()` and `frame.getInsets()` are called 
> > on main thread instead of EDT.
> 
> I couldn't link this comment to the code because GitHub does not allow adding 
> comments to unmodified lines. Do I understand correctly that you're for 
> leaving it as is?

Pretty much. Making frame volatile will not change the behavior, the assignment 
to it made in one place and it's on EDT inside invokeAndWait block, making it 
volatile will change nothing, it will be fully assigned by the time we leave 
EDT. And calling non-disruptive getters such getInsets or getBounds from main 
thread is not a problem either. By that time frame should be visible and in 
position - otherwise we will have much more interesting problems.

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

PR: https://git.openjdk.java.net/jdk/pull/2790

Reply via email to