Added deallocation of SupportLayers (PrintObject::m_support_layers) into the PrintObject destructor and fixed memory leak in modulate_extrusion_by_overlapping_layers().

This commit is contained in:
Lukáš Hejl 2022-02-05 13:27:54 +01:00
parent 7cc4b1d8b4
commit dd3964c8c3
2 changed files with 3 additions and 1 deletions

View file

@ -346,10 +346,11 @@ private:
friend class Print;
PrintObject(Print* print, ModelObject* model_object, const Transform3d& trafo, PrintInstances&& instances);
~PrintObject() {
~PrintObject() override {
if (m_shared_regions && --m_shared_regions->m_ref_cnt == 0)
delete m_shared_regions;
clear_layers();
clear_support_layers();
}
void config_apply(const ConfigBase &other, bool ignore_nonexistent = false) { m_config.apply(other, ignore_nonexistent); }

View file

@ -3754,6 +3754,7 @@ void modulate_extrusion_by_overlapping_layers(
assert(path != nullptr);
polylines.emplace_back(Polyline(std::move(path->polyline)));
path_ends.emplace_back(std::pair<Point, Point>(polylines.back().points.front(), polylines.back().points.back()));
delete path;
}
}
// Destroy the original extrusion paths, their polylines were moved to path_fragments already.