diff --git a/src/map/ENC/atlasdata.cpp b/src/map/ENC/atlasdata.cpp index d960a0c4..6e31ae66 100644 --- a/src/map/ENC/atlasdata.cpp +++ b/src/map/ENC/atlasdata.cpp @@ -6,31 +6,23 @@ bool AtlasData::pointCb(MapEntry *map, void *context) { PointCTX *ctx = (PointCTX*)context; -start: + map->lock.lock(); + ctx->cacheLock.lock(); - MapData *cached = ctx->cache.object(map->path); - if (!cached) { ctx->cacheLock.unlock(); - if (map->lock.tryLock()) { - MapData *data = new MapData(map->path); - data->points(ctx->rect, ctx->points); + MapData *data = new MapData(map->path); + data->points(ctx->rect, ctx->points); - ctx->cacheLock.lock(); - ctx->cache.insert(map->path, data); - - map->lock.unlock(); - } else { - map->lock.lock(); - map->lock.unlock(); - goto start; - } + ctx->cacheLock.lock(); + ctx->cache.insert(map->path, data); } else cached->points(ctx->rect, ctx->points); ctx->cacheLock.unlock(); + map->lock.unlock(); return true; }