You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in the logic for when the Story object removes a VariableObserver from all variables. This is the offending code:
// Remove observer for all variablesfor (Map.Entry<String, List<VariableObserver>> obs : variableObservers.entrySet()) {
obs.getValue().remove(observer);
if (obs.getValue().size() == 0) {
variableObservers.remove(obs.getKey());
}
}
We can see that the variableObservers map is being iterated over here, but inside of the for loop there is a call to remove an element from that map. This always results in a java.util.ConcurrentModificationException being thrown.
The removals should either take place outside of the for loop, or otherwise use an Iterator to do the iteration so that the inner removal can occur without issue. https://stackoverflow.com/a/10432084
The text was updated successfully, but these errors were encountered:
j0rdanit0
added a commit
to j0rdanit0/blade-ink
that referenced
this issue
Oct 21, 2022
blade-ink version
1.0.1
Description:
There is a bug in the logic for when the
Story
object removes aVariableObserver
from all variables. This is the offending code:We can see that the
variableObservers
map is being iterated over here, but inside of the for loop there is a call to remove an element from that map. This always results in ajava.util.ConcurrentModificationException
being thrown.The removals should either take place outside of the for loop, or otherwise use an
Iterator
to do the iteration so that the inner removal can occur without issue. https://stackoverflow.com/a/10432084The text was updated successfully, but these errors were encountered: