RFR: 8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina [v2]
Kevin Rushforth
kcr at openjdk.java.net
Thu Dec 3 17:39:08 UTC 2020
On Thu, 3 Dec 2020 16:39:59 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java line 142:
>>
>>> 140: @Override
>>> 141: protected void notifyDidBecomeActive() {
>>> 142: super.notifyDidBecomeActive();
>>
>> if an exception occurs in this method (which can happen in case the superclass eventHandler.handleDidBecomeActiveAction() throws an exception), the countDownLatch is never decreased, and the `wrappedRunnable` will never return.
>> I am not sure what the best approach is in this case. The Thread that waits for the reactivation is a daemon thread, but there might be other non-daemon threads lingering.
>> One of the options is to set a timeout on the `reactivationLatch`. If the countdown didn't happen almost instantly, something is going wrong.
>
> Good catch. It will block the starting of the app if this happens since we will never exit the nested event loop. Putting the call to `reactivationLatch.countDown();` in a try / finally seems best (although I had earlier considered a timeout as well).
Rather than a try / catch I simply moved the call to super after the setting of the flag in `notifyDidResignActive` and the countdown in `notifyDidBecomeActive`. I also added a timeout just to be safe. It waits for 5 seconds and logs a warning before continuing.
-------------
PR: https://git.openjdk.java.net/jfx/pull/361
More information about the openjfx-dev
mailing list