diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index d3fef44d3..40cd7f889 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -1416,6 +1416,15 @@ void ColourPicker::sys_color_changed() #endif } +PointCtrl::~PointCtrl() +{ + if (sizer) { + sizer->Clear(); + delete sizer; + sizer = nullptr; + } +} + void PointCtrl::BUILD() { auto temp = new wxBoxSizer(wxHORIZONTAL); diff --git a/src/slic3r/GUI/Field.hpp b/src/slic3r/GUI/Field.hpp index 60a06427d..eaa4fe481 100644 --- a/src/slic3r/GUI/Field.hpp +++ b/src/slic3r/GUI/Field.hpp @@ -425,7 +425,7 @@ class PointCtrl : public Field { public: PointCtrl(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {} PointCtrl(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {} - ~PointCtrl() {} + ~PointCtrl(); wxSizer* sizer{ nullptr }; wxTextCtrl* x_textctrl{ nullptr }; diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index cfa2ef15a..0534446f0 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -118,6 +118,24 @@ OptionsGroup::OptionsGroup( wxWindow* _parent, const wxString& title, { } +void Line::clear() +{ + if (near_label_widget_win) + near_label_widget_win = nullptr; + + if (widget_sizer) { + widget_sizer->Clear(true); + delete widget_sizer; + widget_sizer = nullptr; + } + + if (extra_widget_sizer) { + extra_widget_sizer->Clear(true); + delete extra_widget_sizer; + extra_widget_sizer = nullptr; + } +} + wxWindow* OptionsGroup::ctrl_parent() const { return this->custom_ctrl && m_use_custom_ctrl_as_parent ? static_cast(this->custom_ctrl) : (this->stb ? static_cast(this->stb) : this->parent()); @@ -231,7 +249,7 @@ void OptionsGroup::activate_line(Line& line) } } - auto option_set = line.get_options(); + const std::vector