From 6094512f8fc4f313abe8969918a44d9f26239aa2 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 14 Jan 2019 14:42:21 +0100 Subject: [PATCH] Fix of #1645 --- src/slic3r/GUI/GLCanvas3D.cpp | 12 ++++++++++-- src/slic3r/GUI/GUI_App.cpp | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 27f0d54c3e5..50cc028a9a3 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4662,11 +4662,19 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re m_camera.set_scene_box(scene_bounding_box(), *this); m_camera.set_target(m_camera.get_target(), *this); - // if no object is selected, deactivate active gizmo, if any - // otherwise it will be shown after cleaning the scene (while it is active) if (m_selection.is_empty()) + { + // If no object is selected, deactivate the active gizmo, if any + // Otherwise it may be shown after cleaning the scene (if it was active while the objects were deleted) m_gizmos.reset_all_states(); + // If no object is selected, reset the objects manipulator on the sidebar + // to force a reset of its cache + auto manip = wxGetApp().obj_manipul(); + if (manip != nullptr) + manip->update_settings_value(m_selection); + } + // and force this canvas to be redrawn. m_dirty = true; } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4441c8c8bb8..54e3e47503e 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -760,7 +760,8 @@ Sidebar& GUI_App::sidebar() ObjectManipulation* GUI_App::obj_manipul() { - return sidebar().obj_manipul(); + // If this method is called before plater_ has been initialized, return nullptr (to avoid a crash) + return (plater_ != nullptr) ? sidebar().obj_manipul() : nullptr; } ObjectSettings* GUI_App::obj_settings()