Skip to content

Commit d07d5cc

Browse files
author
Andy Goryachev
committedFeb 14, 2025
8349105: Pagination: exception initializing in a background thread
Reviewed-by: kcr, mstrauss
1 parent 01059d4 commit d07d5cc

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

‎modules/javafx.controls/src/main/java/javafx/scene/control/skin/PaginationSkin.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,12 @@ public class PaginationSkin extends SkinBase<Pagination> {
127127
private boolean nextPageReached = false;
128128
private boolean setInitialDirection = false;
129129
private int direction;
130-
131130
private int currentAnimatedIndex;
132-
private boolean hasPendingAnimation = false;
133-
131+
private volatile boolean hasPendingAnimation;
134132
private boolean animate = true;
135-
136133
private final PaginationBehavior behavior;
137134

138135

139-
140136
/* *************************************************************************
141137
* *
142138
* Listeners *
@@ -712,6 +708,10 @@ private int getCurrentPageIndex() {
712708
}
713709

714710
private void animateSwitchPage() {
711+
if (!Platform.isFxApplicationThread()) {
712+
hasPendingAnimation = true;
713+
return;
714+
}
715715
if (timeline != null) {
716716
timeline.setRate(8);
717717
hasPendingAnimation = true;

‎tests/system/src/test/java/test/robot/javafx/scene/NodeInitializationStressTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ public void menuButton() {
402402
});
403403
}
404404

405-
@Disabled("JDK-8349105") // FIX
406405
@Test
407406
public void pagination() {
408407
assumeFalse(SKIP_TEST);
@@ -414,9 +413,10 @@ public void pagination() {
414413
c.setPageFactory((pageIndex) -> {
415414
return new Label(pageIndex + " " + nextString());
416415
});
417-
c.setPageCount(100);
418-
c.setCurrentPageIndex(nextInt(100));
416+
int mx = 1 + nextInt(100);
419417
accessControl(c);
418+
c.setPageCount(mx);
419+
c.setCurrentPageIndex(nextInt(mx));
420420
});
421421
}
422422

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Feb 14, 2025

@openjdk-notifier[bot]
Please sign in to comment.