Use try/finally to ensure oldValue is cleared
If any JS exception is thrown during event delivery the oldValue should still be set to null to enable garbage collection. Change-Id: I740db06e93162f86982ffd418c2072bfb4d5d75c
This commit is contained in:
@@ -23,8 +23,11 @@ public class ListenableOldValue<T> extends ListenableValue<T> {
|
||||
}
|
||||
|
||||
public void set(final T value) {
|
||||
oldValue = get();
|
||||
super.set(value);
|
||||
oldValue = null; // allow it to be gced before the next event
|
||||
try {
|
||||
oldValue = get();
|
||||
super.set(value);
|
||||
} finally {
|
||||
oldValue = null; // allow it to be gced before the next event
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user