From 6811c68f60979b0e07ecb469da613ade88963141 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 11 Mar 2019 11:03:13 +0100 Subject: [PATCH] Fixed crashes if OnIdle handler was called before Plater was initialized. --- src/slic3r/GUI/GUI_App.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 7a3d6f13a..194399316 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -161,12 +161,15 @@ bool GUI_App::OnInit() Bind(wxEVT_IDLE, [this](wxIdleEvent& event) { + if (! plater_) + return; + if (app_config->dirty() && app_config->get("autosave") == "1") app_config->save(); // ! Temporary workaround for the correct behavior of the Scrolled sidebar panel // Do this "manipulations" only once ( after (re)create of the application ) - if (plater_ && sidebar().obj_list()->GetMinHeight() > 15 * wxGetApp().em_unit()) + if (sidebar().obj_list()->GetMinHeight() > 15 * wxGetApp().em_unit()) { wxWindowUpdateLocker noUpdates_sidebar(&sidebar()); sidebar().obj_list()->SetMinSize(wxSize(-1, 15 * wxGetApp().em_unit())); @@ -175,8 +178,7 @@ bool GUI_App::OnInit() update_mode(); // update view mode after fix of the object_list size } - if (this->plater() != nullptr) - this->obj_manipul()->update_if_dirty(); + this->obj_manipul()->update_if_dirty(); // Preset updating & Configwizard are done after the above initializations, // and after MainFrame is created & shown.