Skip to content

Commit 37463e9

Browse files
authored
Fix a locking error by ensuring we lock/unlock on the same object. (#10469)
1 parent 474b788 commit 37463e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

game-app/game-core/src/main/java/games/strategy/triplea/ui/TerritoryDetailPanel.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ private void territoryChanged(final @Nullable Territory territory) {
175175
final String unitsLabel;
176176

177177
// Get the unit information under lock as otherwise they may change on the game thread causing a
178-
// ConcurrentModificationException.
178+
// ConcurrentModificationException. Use local variable to ensure we lock/unlock the same object.
179+
final GameData gameData = this.gameData;
179180
gameData.acquireReadLock();
180181
try {
181182
unitsList = UnitSeparator.getSortedUnitCategories(territory, uiContext.getMapData());

0 commit comments

Comments
 (0)