From e52d98ad8bcce5b85647921a7aa12168451a1ac6 Mon Sep 17 00:00:00 2001 From: SquidDev Date: Fri, 10 Apr 2020 14:28:46 +0100 Subject: [PATCH] Make IDAssigner.getNextID synchronized This should prevent race conditions when allocating IDs. Fixes #386. --- src/main/java/dan200/computercraft/shared/util/IDAssigner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dan200/computercraft/shared/util/IDAssigner.java b/src/main/java/dan200/computercraft/shared/util/IDAssigner.java index fd0f222ab..fbbf461bf 100644 --- a/src/main/java/dan200/computercraft/shared/util/IDAssigner.java +++ b/src/main/java/dan200/computercraft/shared/util/IDAssigner.java @@ -36,7 +36,7 @@ public final class IDAssigner return getNextID( file, false ); } - private static int getNextID( File location, boolean directory ) + private static synchronized int getNextID( File location, boolean directory ) { // Determine where to locate ID file File lastIdFile;