-
Notifications
You must be signed in to change notification settings - Fork 542
8277122: SplitPane divider drag can hang the layout #669
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
8277122: SplitPane divider drag can hang the layout #669
Conversation
|
👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
interesting issue - and fix :) Verified the mis-behaviour before the fix and its working after. Wondering, though (read: I don't understand 😀)
As to the test: would prefer to also see a test of the fixed effect (vs. the fix implementation of not re-entering layout) - might be a bit tricky, though. |
Do you mean something like checking the EDIT: I added another test for decreasing the divider position to a negatiave number. :) |
|
/reviewers 2 |
|
@aghaisas |
kleopatra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix looks good (though it feels a bit upside down that it is needed ;) - verified example/tests failing/passing before/after fixing
left minor inline comments (just to make it easier to understand :)
modules/javafx.controls/src/main/java/javafx/scene/control/skin/SplitPaneSkin.java
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/skin/SplitPaneSkin.java
Show resolved
Hide resolved
modules/javafx.controls/src/test/java/test/javafx/scene/control/SplitPaneTest.java
Show resolved
Hide resolved
| stageLoader.dispose(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the stageLoader is not disposed if the test fails - a (recently introduced :) general pattern is to use an instance field that's disposed in the test cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, is this really needed? Not sure, are there any side effects by the StageLoader like this when a test failed?
Just asking since the StageLoader is used a lot like this.
And since the tests normally run green unless you may change something locally (on the JavaFX Pipeline it should never be red), it would probably never affect anything (or maybe it does?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, is this really needed?
yes, IMO, we want the exact same cleanup for passing/failing tests. So either dispose is required always (then need to make sure it's called on failure) or not required always (then all its calls would be noise).
Not sure, are there any side effects by the
StageLoaderlike this when a test failed? Just asking since theStageLoaderis used a lot like this.
don't now (and doesn't matter, what matters is the guaranteed cleanup) - and aware of those slightly fishy patterns, we all learn :) Faintly remember having discussed the point in a PR (can't find it right now, though), and just as faintly remember the outcome was to guarantee the cleanup in new tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay. Was just confusing for me since I never read that and I think some recent PRs still had this pattern, e.g. also the touch table scrolling PR I had a look at yesterday.
Maybe for future it makes sense to have an abstract test class with the stage loader setup already in place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for reference - found the source of my faintly remember
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Unfortunately though that was not done consistently during the past PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Also adjusted the copyright year ;)
kleopatra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good now :)
aghaisas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good. +1.
|
@Maran23 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: 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 62 new commits pushed to the
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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kleopatra, @aghaisas) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
/integrate |
|
/sponsor |
|
Going to push as commit ee52d14.
Your commit was automatically rebased without conflicts. |
|
@kleopatra @Maran23 Pushed as commit ee52d14. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When a divider is moved via drag or code it will call requestLayout() for the SplitPane.
While this is fine, it is also called when the SplitPaneSkin#layoutChildren(..) method is repositioning the divider.
This makes no sense since we are currently layouting everything, so we don't need to request it again. (The divider positioning is the first part of layoutChildren(..). In the second part the SplitPane content is layouted based off those positions)
-> With this behaviour the layout may hang under some conditions (check attached source). The problem is that the requestLayout() will mark the SplitPane dirty but won't propagate to the parent since the SplitPane is currently doing a layout.
This PR fixes this by not requesting layout when we are currently doing it (and thus repositioning the dividers as part of it).
Note: I also fixed a simple typo of a private method in SplitPaneSkin:
initializeDivderEventHandlers -> initializeDividerEventHandlers
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/669/head:pull/669$ git checkout pull/669Update a local copy of the PR:
$ git checkout pull/669$ git pull https://git.openjdk.java.net/jfx pull/669/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 669View PR using the GUI difftool:
$ git pr show -t 669Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/669.diff