1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-02-17 16:20:48 +01:00

Fixed possible double delete

QCache takes ownership (deletes the object) even if insert returns false!
This commit is contained in:
Martin Tůma 2023-11-26 12:32:14 +01:00
parent 6d03834167
commit c4bd3d39d1

View File

@ -13,8 +13,7 @@ bool AtlasData::pointCb(const QString *map, void *context)
if (!cached) {
MapData *data = new MapData(*map);
data->points(ctx->rect, ctx->points);
if (!ctx->cache.insert(map, data))
delete data;
ctx->cache.insert(map, data);
} else
cached->points(ctx->rect, ctx->points);
@ -35,8 +34,7 @@ bool AtlasData::polyCb(const QString *map, void *context)
MapData *data = new MapData(*map);
data->polygons(ctx->rect, ctx->polygons);
data->lines(ctx->rect, ctx->lines);
if (!ctx->cache.insert(map, data))
delete data;
ctx->cache.insert(map, data);
} else {
cached->polygons(ctx->rect, ctx->polygons);
cached->lines(ctx->rect, ctx->lines);