Found while randomly looking at the code:
In AccordionBehavior:280, the body of ListChangeListener uses getAddedSubList() while processing removed elements:
```
private final ListChangeListener<TitledPane> panesListener = c -> {
while (c.next()) {
if (c.wasAdded()) {
for (final TitledPane tp: c.getAddedSubList()) {
tp.focusedProperty().addListener(paneFocusListener);
}
} else if (c.wasRemoved()) {
for (final TitledPane tp: c.getAddedSubList()) {
tp.focusedProperty().removeListener(paneFocusListener);
}
}
}
};
```
This looks like a copy-paste bug which was introduced byRT-32103 / JDK-8123765 on 2013/08/02.
We'd need to check if a similar pattern has been used elsewhere (may be create a script or a regex pattern?)
EDIT: Regex pattern used in Eclipse
(?s)wasRemoved.*getAddedSubList
identified the following places:
AccordionBehavior:280
Rule:269
And the other way around
(?s)wasAdded.*getRemoved
did not turn up any similar issues.
In AccordionBehavior:280, the body of ListChangeListener uses getAddedSubList() while processing removed elements:
```
private final ListChangeListener<TitledPane> panesListener = c -> {
while (c.next()) {
if (c.wasAdded()) {
for (final TitledPane tp: c.getAddedSubList()) {
tp.focusedProperty().addListener(paneFocusListener);
}
} else if (c.wasRemoved()) {
for (final TitledPane tp: c.getAddedSubList()) {
tp.focusedProperty().removeListener(paneFocusListener);
}
}
}
};
```
This looks like a copy-paste bug which was introduced by
We'd need to check if a similar pattern has been used elsewhere (may be create a script or a regex pattern?)
EDIT: Regex pattern used in Eclipse
(?s)wasRemoved.*getAddedSubList
identified the following places:
AccordionBehavior:280
Rule:269
And the other way around
(?s)wasAdded.*getRemoved
did not turn up any similar issues.
- relates to
-
JDK-8123765 Behaviors should remove listeners when Skin is disposed
- Resolved