Commit 977bf257 authored by Volker Krause's avatar Volker Krause Committed by Torsten Rahn
Browse files

Don't leak temporary placemark copies

parent 548278fb
......@@ -232,11 +232,12 @@ void VectorClipper::clipPolygon(const GeoDataPlacemark *placemark, const Clipper
{
bool isBuilding = false;
GeoDataPolygon* polygon;
std::unique_ptr<GeoDataPlacemark> copyPlacemark;
if (const auto building = geodata_cast<GeoDataBuilding>(placemark->geometry())) {
polygon = geodata_cast<GeoDataPolygon>(&static_cast<GeoDataMultiGeometry*>(building->multiGeometry())->at(0));
isBuilding = true;
} else {
GeoDataPlacemark* copyPlacemark = new GeoDataPlacemark(*placemark);
copyPlacemark.reset(new GeoDataPlacemark(*placemark));
polygon = geodata_cast<GeoDataPolygon>(copyPlacemark->geometry());
}
......
......@@ -54,11 +54,12 @@ private:
{
bool isBuilding = false;
const T* ring;
std::unique_ptr<GeoDataPlacemark> copyPlacemark;
if (const auto building = geodata_cast<GeoDataBuilding>(placemark->geometry())) {
ring = geodata_cast<T>(&static_cast<const GeoDataMultiGeometry*>(building->multiGeometry())->at(0));
isBuilding = true;
} else {
GeoDataPlacemark* copyPlacemark = new GeoDataPlacemark(*placemark);
copyPlacemark.reset(new GeoDataPlacemark(*placemark));
ring = geodata_cast<T>(copyPlacemark->geometry());
}
bool const isClosed = ring->isClosed() && canBeArea(placemark->visualCategory());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment