Hold lock while calling notifyObservers().

This commit is contained in:
akwizgran
2021-06-15 11:47:10 +01:00
parent 07162cad8b
commit faab80f0ea

View File

@@ -94,15 +94,15 @@ abstract class RemovableDriveTaskImpl implements RemovableDriveTask {
done = min(state.getDone() + done, state.getTotal());
state = new State(done, state.getTotal(), state.isFinished(),
state.isSuccess());
notifyObservers();
}
notifyObservers();
}
void setSuccess(boolean success) {
synchronized (lock) {
state = new State(state.getDone(), state.getTotal(), true, success);
notifyObservers();
}
notifyObservers();
}
@GuardedBy("lock")