Cut: Deallocate memory when the gizmo is turned off
This commit is contained in:
parent
ab0ade0539
commit
0e1d43322c
@ -905,6 +905,13 @@ void GLGizmoCut3D::on_set_state()
|
|||||||
m_selected.clear();
|
m_selected.clear();
|
||||||
m_parent.set_use_color_clip_plane(false);
|
m_parent.set_use_color_clip_plane(false);
|
||||||
m_c->selection_info()->set_use_shift(false);
|
m_c->selection_info()->set_use_shift(false);
|
||||||
|
|
||||||
|
// Make sure that the part selection data are released when the gizmo is closed.
|
||||||
|
// The CallAfter is needed because in perform_cut, the gizmo is closed BEFORE
|
||||||
|
// the cut is performed (because of undo/redo snapshots), so the data would
|
||||||
|
// be deleted prematurely.
|
||||||
|
if (m_part_selection.valid())
|
||||||
|
wxGetApp().CallAfter([this]() { m_part_selection = PartSelection(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ class GLGizmoCut3D : public GLGizmoBase
|
|||||||
public:
|
public:
|
||||||
PartSelection() = default;
|
PartSelection() = default;
|
||||||
PartSelection(const ModelObject* mo, const Transform3d& cut_matrix, int instance_idx, const Vec3d& center, const Vec3d& normal, const CommonGizmosDataObjects::ObjectClipper& oc);
|
PartSelection(const ModelObject* mo, const Transform3d& cut_matrix, int instance_idx, const Vec3d& center, const Vec3d& normal, const CommonGizmosDataObjects::ObjectClipper& oc);
|
||||||
|
~PartSelection() { m_model.clear_objects(); }
|
||||||
|
|
||||||
struct Part {
|
struct Part {
|
||||||
GLModel glmodel;
|
GLModel glmodel;
|
||||||
|
Loading…
Reference in New Issue
Block a user