Skip to content

Commit

Permalink
Update of Settings in ObjectList from Tab::update() is suppressed, if…
Browse files Browse the repository at this point in the history
… Undo/Redo is not completed
  • Loading branch information
YuSanka committed Mar 20, 2020
1 parent a9fc394 commit ec381c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/slic3r/GUI/Plater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ class Plater: public wxPanel
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)); }
Expand Down
10 changes: 8 additions & 2 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit ec381c5

Please sign in to comment.