Skip to content

Commit

Permalink
fix group number-background-color state in group panel when entries s…
Browse files Browse the repository at this point in the history
…elected

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.
  • Loading branch information
Fancy Z committed Oct 23, 2018
1 parent c343e16 commit a907fb6
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/main/java/org/jabref/gui/util/BindingsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import javafx.collections.ObservableMap;
import javafx.css.PseudoClass;
import javafx.scene.Node;
import org.fxmisc.easybind.EasyBind;


/**
Expand All @@ -41,23 +42,7 @@ public static <T> BooleanBinding all(ObservableList<T> source, Predicate<T> pred
}

public static void includePseudoClassWhen(Node node, PseudoClass pseudoClass, ObservableValue<? extends Boolean> 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));
}

/**
Expand Down

0 comments on commit a907fb6

Please sign in to comment.