diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f6be4bc68..8388c1cfd 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1992,6 +1992,7 @@ struct Plater::priv mutable bool ready_to_slice = { false }; // Flag indicating that the G-code export targets a removable device, therefore the show_action_buttons() needs to be called at any case when the background processing finishes. bool writing_to_removable_device = { false }; + bool inside_snapshot_capture() { return m_prevent_snapshots != 0; } private: bool init_object_menu(); @@ -5737,6 +5738,7 @@ bool Plater::can_reload_from_disk() const { return p->can_reload_from_disk(); } const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_redo_stack_main(); } void Plater::enter_gizmos_stack() { p->enter_gizmos_stack(); } void Plater::leave_gizmos_stack() { p->leave_gizmos_stack(); } +bool Plater::inside_snapshot_capture() { return p->inside_snapshot_capture(); } // Wrapper around wxWindow::PopupMenu to suppress error messages popping out while tracking the popup menu. bool Plater::PopupMenu(wxMenu *menu, const wxPoint& pos) diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index f737cf59a..32709a4bd 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -319,6 +319,8 @@ public: Plater *m_plater; }; + bool inside_snapshot_capture(); + // Wrapper around wxWindow::PopupMenu to suppress error messages popping out while tracking the popup menu. bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition); bool PopupMenu(wxMenu *menu, int x, int y) { return this->PopupMenu(menu, wxPoint(x, y)); } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 01b9b22ac..adfae9024 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1359,7 +1359,10 @@ void TabPrint::update() if (m_update_cnt==0) { m_config_manipulation.toggle_print_fff_options(m_config); - wxGetApp().obj_list()->update_and_show_object_settings_item(); + // update() could be called during undo/redo execution + // Update of objectList can cause a crash in this case (because m_objects doesn't match ObjectList) + if (!wxGetApp().plater()->inside_snapshot_capture()) + wxGetApp().obj_list()->update_and_show_object_settings_item(); wxGetApp().mainframe->on_config_changed(m_config); } @@ -3761,7 +3764,10 @@ void TabSLAPrint::update() if (m_update_cnt == 0) { m_config_manipulation.toggle_print_sla_options(m_config); - wxGetApp().obj_list()->update_and_show_object_settings_item(); + // update() could be called during undo/redo execution + // Update of objectList can cause a crash in this case (because m_objects doesn't match ObjectList) + if (!wxGetApp().plater()->inside_snapshot_capture()) + wxGetApp().obj_list()->update_and_show_object_settings_item(); wxGetApp().mainframe->on_config_changed(m_config); }