[OpenJDK 2D-Dev]  Review Request: 8229810 NullPointerException getting bounds of GraphicsConfiguration
Sergey.Bylokhov at oracle.com
Thu Oct 3 21:49:24 UTC 2019
> I think we should drive device update through GraphicsEnvironment.displayChanged() and DisplayChangeListener instead of force updating bounds in GraphicsDevice.displayChanged in the constructor.
> We can synchronise the GraphicsEnvironment.displayChanged() by calling it under CGraphicsEnvironment.initDevices() sync lock, this will force call DisplayChangeListener when devices are updated.
Unfortunately, we cannot move the "displayChanged()" method under the lock,
because this method will notify all DisplayChangedListener which might use some
other locks, so we will have GraphicsEnvironment.sync->SomeOther locks order,
and at the same time, some other thread may acquired SomeOther lock and tried to
call CGraphicsEnvironment.getScreenDevices(), so we will get
SomeOther->CGraphicsEnvironment.sync and this will cause a deadlock.
Best regards, Sergey.
More information about the 2d-dev