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

8350048: Enforce threading restrictions for show and hide methods in Window, Control, and Skin #1717

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

andy-goryachev-oracle
Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle commented Feb 19, 2025

  • enforced fx application thread
  • added a headful test TestThreadingRestrictions

Note to the Reviewers

To avoid merge conflicts, the preferred order of integrations:

#1697
#1713
#1717


Progress

  • Change requires a CSR request matching fixVersion jfx25 to be approved (needs to be created)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 2 Reviewers)

Issue

  • JDK-8350048: Enforce threading restrictions for show and hide methods in Window, Control, and Skin (Bug - P3)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1717/head:pull/1717
$ git checkout pull/1717

Update a local copy of the PR:
$ git checkout pull/1717
$ git pull https://git.openjdk.org/jfx.git pull/1717/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1717

View PR using the GUI difftool:
$ git pr show -t 1717

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1717.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 19, 2025

👋 Welcome back angorya! 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.

@openjdk
Copy link

openjdk bot commented Feb 19, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@kevinrushforth
Copy link
Member

/reviewers 2 reviewers
/csr

@openjdk
Copy link

openjdk bot commented Feb 19, 2025

@kevinrushforth
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 2 Reviewers).

@openjdk openjdk bot added the csr Need approved CSR to integrate pull request label Feb 19, 2025
@openjdk
Copy link

openjdk bot commented Feb 19, 2025

@kevinrushforth has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@andy-goryachev-oracle please create a CSR request for issue JDK-8350048 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@mlbridge
Copy link

mlbridge bot commented Feb 20, 2025

Webrevs

@kevinrushforth
Copy link
Member

Reviewers: @kevinrushforth @arapte

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API doc changes look good, although I noted a couple additional changes that are needed.

The API docs for Dialog::hide should also be documented to throw ISE (since it calls close() directly the implementation is fine)

The API docs for Stage::close should also be documented to throw ISE (since it calls hide() directly the implementation is fine)

For ComboBoxBase, were you going to get rid of the word "aspect" in the opening sentence "... display the popup aspect of the user interface."? I think that's a little awkward even with that word removed. Maybe it could just be: "... display the popup associated with this control."

As for the implementation, There are a few places where the skin will call hide(), and I can't tell by just looking at the code that they are all guaranteed to be on the FX app thread.

For example, I recommend checking the following:

  • MenuBarSkin line 799
  • ComboBoxListViewSkin line 199

There may be others.

*
* This test ensures that the threading restrictions are in place where required.
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary (and not a usual practice).


test(TPopupWindow::new, (p) -> p.show(stage));
test(TPopupWindow::new, (p) -> p.show(stage, 0, 0));
test(TPopupWindow::new, (p) -> p.show(contentPane, 0, 0));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth adding a test for hide when it isn't showing (like you've done for other objects).

Util.runAndWait(() -> {
p.show();
});
p.hide(); // do we need to fail early here, or only when showing?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fail early (although this comment seems misplaced, since it is the case where it is showing).

}

@Test
@Timeout(value = 1, unit = TimeUnit.DAYS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, 1 DAY???

Seriously, though: Remove the timeout (it isn't needed or wanted).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csr Need approved CSR to integrate pull request rfr Ready for review
Development

Successfully merging this pull request may close these issues.

2 participants