Update of Settings in ObjectList from Tab::update() is suppressed, if Undo/Redo is not completed

This commit is contained in:
YuSanka 2020-03-20 13:41:36 +01:00
parent a9fc39491e
commit ec381c5854
3 changed files with 12 additions and 2 deletions

View File

@ -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)

View File

@ -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)); }

View File

@ -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);
}