add missing synchronized blocks

This commit is contained in:
Leijurv 2018-11-28 18:21:27 -08:00
parent 043d6ffd20
commit 6f7729e34e
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -280,11 +280,13 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
} }
public void softCancelIfSafe() { public void softCancelIfSafe() {
synchronized (pathPlanLock) {
if (!isSafeToCancel()) { if (!isSafeToCancel()) {
return; return;
} }
current = null; current = null;
next = null; next = null;
}
cancelRequested = true; cancelRequested = true;
getInProgress().ifPresent(AbstractNodeCostSearch::cancel); // only cancel ours getInProgress().ifPresent(AbstractNodeCostSearch::cancel); // only cancel ours
// do everything BUT clear keys // do everything BUT clear keys
@ -293,8 +295,10 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
// just cancel the current path // just cancel the current path
public void secretInternalSegmentCancel() { public void secretInternalSegmentCancel() {
queuePathEvent(PathEvent.CANCELED); queuePathEvent(PathEvent.CANCELED);
synchronized (pathPlanLock) {
current = null; current = null;
next = null; next = null;
}
baritone.getInputOverrideHandler().clearAllKeys(); baritone.getInputOverrideHandler().clearAllKeys();
getInProgress().ifPresent(AbstractNodeCostSearch::cancel); getInProgress().ifPresent(AbstractNodeCostSearch::cancel);
baritone.getInputOverrideHandler().getBlockBreakHelper().stopBreakingBlock(); baritone.getInputOverrideHandler().getBlockBreakHelper().stopBreakingBlock();
@ -334,8 +338,10 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
} }
public void secretCursedFunctionDoNotCall(IPath path) { public void secretCursedFunctionDoNotCall(IPath path) {
synchronized (pathPlanLock) {
current = new PathExecutor(this, path); current = new PathExecutor(this, path);
} }
}
/** /**
* See issue #209 * See issue #209