Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8231372: JFXPanel fails to render if setScene called on Swing thread #362

Conversation

@kevinrushforth
Copy link
Member

@kevinrushforth kevinrushforth commented Dec 4, 2020

This fix was originally proposed by @mruzicka in PR #16 which was closed several months ago without being integrated. At the time we didn't have a test case that was failing.

While evaluating a bug that I filed, JDK-8235843, I discovered that that bug was a duplicate of this one. The original proposed fix is correct, although I modified it slightly to add a try / finally so that the secondary event loop will be terminated even if the setScene throws an exception. I also added a unit test. Since the bulk of the fix is from PR #16, I will add the contributor of that PR.

NOTE to reviewers: I pushed two commits to my branch. The first is exactly the commit created for PR #16 and the second is the unit test along with the fix to the code to add try / finally. As always, they will be squashed into a single commit by Skara.

/summary Correctly terminate secondary event loop in JFXPanel::setScene

/contributor add Michal Růžička michal.ruza@gmail.com


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8231372: JFXPanel fails to render if setScene called on Swing thread

Reviewers

Contributors

  • Michal Růžička <michal.ruza@gmail.com>

Download

$ git fetch https://git.openjdk.java.net/jfx pull/362/head:pull/362
$ git checkout pull/362

mruzicka and others added 2 commits Sep 19, 2019
Secondary event loop introduced as a means of synchronization with the JavaFX
Application thread in [1] never terminates as the SecondaryLoop.exit() call is
not reached because the thread is blocked in the SecondaryLoop.enter() call.
This patch fixes the problem by submitting the UI work (including the call
to the SecondaryLoop.exit() method) before entering the secondary loop.

[1] 7cf2dfa
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Dec 4, 2020

👋 Welcome back kcr! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@kevinrushforth kevinrushforth requested a review from prsadhuk Dec 4, 2020
@openjdk openjdk bot added the rfr label Dec 4, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 4, 2020

@kevinrushforth Setting summary to Correctly terminate secondary event loop in JFXPanel::setScene

@openjdk
Copy link

@openjdk openjdk bot commented Dec 4, 2020

@kevinrushforth
Contributor Michal Růžička <michal.ruza@gmail.com> successfully added.

@kevinrushforth
Copy link
Member Author

@kevinrushforth kevinrushforth commented Dec 4, 2020

/reviewers 2

@kevinrushforth kevinrushforth requested a review from arapte Dec 4, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 4, 2020

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@mlbridge
Copy link

@mlbridge mlbridge bot commented Dec 4, 2020

Webrevs

@kevinrushforth
Copy link
Member Author

@kevinrushforth kevinrushforth commented Dec 5, 2020

I noticed that the Swing JFrames weren't being hidden after each test, so I added an @After cleanup method.

@arapte
arapte approved these changes Dec 7, 2020
@kevinrushforth kevinrushforth requested a review from prsadhuk Dec 7, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 8, 2020

@kevinrushforth This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8231372: JFXPanel fails to render if setScene called on Swing thread

Correctly terminate secondary event loop in JFXPanel::setScene

Co-authored-by: Michal Růžička <michal.ruza@gmail.com>
Reviewed-by: psadhukhan, arapte

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 3 new commits pushed to the master branch:

  • e7dbdfc: 8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina
  • ca0d3d0: 8256821: TreeViewSkin/Behavior: misbehavior on switching skin
  • 00a8646: 8247576: Labeled/SkinBase: misbehavior on switching skin

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Dec 8, 2020
@kevinrushforth
Copy link
Member Author

@kevinrushforth kevinrushforth commented Dec 8, 2020

/integrate

@openjdk openjdk bot closed this Dec 8, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Dec 8, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 8, 2020

@kevinrushforth Since your change was applied there have been 3 commits pushed to the master branch:

  • e7dbdfc: 8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina
  • ca0d3d0: 8256821: TreeViewSkin/Behavior: misbehavior on switching skin
  • 00a8646: 8247576: Labeled/SkinBase: misbehavior on switching skin

Your commit was automatically rebased without conflicts.

Pushed as commit 794ffc0.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@kevinrushforth kevinrushforth deleted the kevinrushforth:8231372-JFXPanel-secondary-loop branch Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants