RFR: 8305352: updateIconImages may lead to deadlock after JDK-8276849
Phil Race
prr at openjdk.org
Fri Mar 31 18:32:16 UTC 2023
On Fri, 31 Mar 2023 09:11:20 GMT, Dmitry Cherepanov <dcherepanov at openjdk.org> wrote:
> Please review this PR which suggests to skip updateIconImages() for not yet visible windows. The displayChanged notification can be sent to a window that is in the process of initiailization and calling updateIconImages() may lead to the deadlock.
>
> Testing: the deadlock no longer happens with this patch. The reg test for JDK-8276849 works (window icon is updated after changing DPI settings).
No objections to a safe fix for this, but the app is creating and - more to the point - showing (setVisible) the AWT window on the main thread.
Even for AWT (non-swing) apps, it is recommended to do it on the EDT to avoid threading issues - such as this.
Lots of apps do use the main thread, and have no issues but that's not guaranteed.
I can't find where this is documented .. I do remember it was quite a number of years ago that this advice was first offered.
I suppose you could not create a reliable test for this ? Please add noreg-hard to the bug.
-------------
Marked as reviewed by prr (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13263#pullrequestreview-1367407739
More information about the client-libs-dev
mailing list