From 5243d3e53c1da2443fbb8d118f6ceae01dcd1dba Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 25 Sep 2020 10:44:22 +0200 Subject: [PATCH] Fixed crash on BedShapeDialog creation --- src/slic3r/GUI/BedShapeDialog.cpp | 14 ++++++++++---- src/slic3r/GUI/BedShapeDialog.hpp | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index 3caf168b5..781838233 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -229,11 +229,11 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf auto optgroup = init_shape_options_page(BedShape::get_name(BedShape::Type::Rectangular)); BedShape::append_option_line(optgroup, BedShape::Parameter::RectSize); BedShape::append_option_line(optgroup, BedShape::Parameter::RectOrigin); - optgroup->activate(); + activate_options_page(optgroup); optgroup = init_shape_options_page(BedShape::get_name(BedShape::Type::Circular)); BedShape::append_option_line(optgroup, BedShape::Parameter::Diameter); - optgroup->activate(); + activate_options_page(optgroup); optgroup = init_shape_options_page(BedShape::get_name(BedShape::Type::Custom)); @@ -254,7 +254,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf return sizer; }; optgroup->append_line(line); - optgroup->activate(); + activate_options_page(optgroup); wxPanel* texture_panel = init_texture_panel(); wxPanel* model_panel = init_model_panel(); @@ -297,12 +297,18 @@ ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(const wxString& tit }; m_optgroups.push_back(optgroup); - panel->SetSizerAndFit(optgroup->sizer); +// panel->SetSizerAndFit(optgroup->sizer); m_shape_options_book->AddPage(panel, title); return optgroup; } +void BedShapePanel::activate_options_page(ConfigOptionsGroupShp options_group) +{ + options_group->activate(); + options_group->parent()->SetSizerAndFit(options_group->sizer); +} + wxPanel* BedShapePanel::init_texture_panel() { wxPanel* panel = new wxPanel(this); diff --git a/src/slic3r/GUI/BedShapeDialog.hpp b/src/slic3r/GUI/BedShapeDialog.hpp index 2cfbc73ae..370129f2e 100644 --- a/src/slic3r/GUI/BedShapeDialog.hpp +++ b/src/slic3r/GUI/BedShapeDialog.hpp @@ -75,6 +75,7 @@ public: private: ConfigOptionsGroupShp init_shape_options_page(const wxString& title); + void activate_options_page(ConfigOptionsGroupShp options_group); wxPanel* init_texture_panel(); wxPanel* init_model_panel(); void set_shape(const ConfigOptionPoints& points);