From f79614d7d032c8b95c1318972c3c3b424c259281 Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 16 Oct 2024 07:03:47 +0200 Subject: [PATCH] fix not on fx thread (#11974) Fixes https://github.com/JabRef/jabref/issues/11966 --- .../java/org/jabref/gui/undo/CountingUndoManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/undo/CountingUndoManager.java b/src/main/java/org/jabref/gui/undo/CountingUndoManager.java index 1e4eaa8981da..6a0c4a557e52 100644 --- a/src/main/java/org/jabref/gui/undo/CountingUndoManager.java +++ b/src/main/java/org/jabref/gui/undo/CountingUndoManager.java @@ -10,13 +10,15 @@ import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleIntegerProperty; +import org.jabref.gui.util.UiTaskExecutor; + public class CountingUndoManager extends UndoManager { private int unchangedPoint; /** * Indicates the number of edits aka balance of edits on the stack +1 when an edit is added/redone and -1 when an edit is undoed. - * */ + */ private final IntegerProperty balanceProperty = new SimpleIntegerProperty(0); private final BooleanProperty undoableProperty = new SimpleBooleanProperty(false); private final BooleanProperty redoableProperty = new SimpleBooleanProperty(false); @@ -67,11 +69,11 @@ private void decrementBalance() { } private void updateUndoableStatus() { - undoableProperty.setValue(canUndo()); + UiTaskExecutor.runInJavaFXThread(() -> undoableProperty.setValue(canUndo())); } private void updateRedoableStatus() { - redoableProperty.setValue(canRedo()); + UiTaskExecutor.runInJavaFXThread(() -> redoableProperty.setValue(canRedo())); } public ReadOnlyBooleanProperty getUndoableProperty() {