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:
parent
6d03834167
commit
c4bd3d39d1
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user