Do not run the InfoTextSwingWorker on the EDT thread - #4802
Merged
cwisniew merged 2 commits intoMay 27, 2024
Conversation
It's meant to be run off-thread, so use `.execute()` instead of `.run()`.
Collaborator
Author
|
Targetting the 1.15 release with this one so bugs can be properly reported for that version. |
cwisniew
approved these changes
May 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Identify the Bug or Feature request
Fixes #4801
Description of the Change
This changes the data gathering task for Gather Debug Information... to run on a background thread rather than the EDT thread. The dialog as a result now shows the text "Gathering information, please wait..." until the dialog is populated, rather than being blank. The dialog also no longer hangs indefinitely.
The reason we previously got away with running that task on the EDT thread is that
SwingWorkerwould always run thedone()method after the internalFutureTask<>completes, so theget()method would have a result to return. But since Java 21, it runsdone()as part of theFutureTask<>callback if running on the EDT thread, i.e., it runsdone()before the task completes. Theget()call therefore blocks as it has no result yet, and the task is blocked from completing and providing those results.I audited the rest of our
SwingWorkertasks, but they are all run via.execute()and thus are safe from this issue. Only one task (RenderPathWorker) is run in a dfiferent manner, but it is on its own non-EDT executor. One unnecessary usage of that worker was found and removed though.Possible Drawbacks
None
Documentation Notes
N/A
Release Notes
This change is