From 940fa2ce3f5579d65b503d4d294f832be5c9d2a9 Mon Sep 17 00:00:00 2001 From: Fancy Zhang Date: Fri, 26 Oct 2018 22:34:36 +0800 Subject: [PATCH] fixed an issue where corresponding groups are sometimes not highlighted when clicking on entries (#4404) * fixed an issue where corresponding groups are sometimes not highlighted when clicking on entries : the cause of this bug is that the local variable "pseudoClassState" is garbaged by java gc. there is no reference to this variable except an weak one from "bind" function. * Remove unused imports * Update BindingsHelper.java --- CHANGELOG.md | 1 + .../org/jabref/gui/util/BindingsHelper.java | 20 +------------------ 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d32677a43e..91a47bb024c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# ### Fixed +- We fixed an issue where corresponding groups are sometimes not highlighted when clicking on entries [#3112](https://github.com/JabRef/jabref/issues/3112) - We fixed an issue where custom exports could not be selected in the 'Export (selected) entries' dialog [#4013](https://github.com/JabRef/jabref/issues/4013) - Italic text is now rendered correctly. https://github.com/JabRef/jabref/issues/3356 - The entry editor no longer gets corrupted after using the source tab. https://github.com/JabRef/jabref/issues/3532 https://github.com/JabRef/jabref/issues/3608 https://github.com/JabRef/jabref/issues/3616 diff --git a/src/main/java/org/jabref/gui/util/BindingsHelper.java b/src/main/java/org/jabref/gui/util/BindingsHelper.java index 8ae0b7be563..162fb210065 100644 --- a/src/main/java/org/jabref/gui/util/BindingsHelper.java +++ b/src/main/java/org/jabref/gui/util/BindingsHelper.java @@ -9,8 +9,6 @@ import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.beans.binding.StringBinding; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.BooleanPropertyBase; import javafx.beans.property.ListProperty; import javafx.beans.property.Property; import javafx.beans.value.ChangeListener; @@ -44,23 +42,7 @@ public static BooleanBinding all(ObservableList source, Predicate pred } public static void includePseudoClassWhen(Node node, PseudoClass pseudoClass, ObservableValue condition) { - BooleanProperty pseudoClassState = new BooleanPropertyBase(false) { - @Override - protected void invalidated() { - node.pseudoClassStateChanged(pseudoClass, get()); - } - - @Override - public Object getBean() { - return node; - } - - @Override - public String getName() { - return pseudoClass.getPseudoClassName(); - } - }; - pseudoClassState.bind(condition); + condition.addListener((obs, oldValue, newValue) -> node.pseudoClassStateChanged(pseudoClass, newValue)); } /**