Attempt to fix #22511: Deadlock in DataSet#beginUpdate

This race occurs when
* MapWithAI is downloading and cleaning data *and*
* JOSM is performing a map paint

This attempts to fix the issue by getting a write lock
*prior to* entering any synchronized methods in DataSet.

Signed-off-by: Taylor Smock <tsmock@meta.com>
pull/6/head
Taylor Smock 2022-11-17 09:23:17 -07:00
rodzic ed1af91aef
commit 6d1ab18335
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -349,7 +349,7 @@ public final class MapWithAIDataUtils {
final Lock lock = layer.getLock();
lock.lock();
try {
mapWithAISet.mergeFrom(newData);
mapWithAISet.update(() -> mapWithAISet.mergeFrom(newData));
GetDataRunnable.cleanup(mapWithAISet, null, null);
} finally {
lock.unlock();