An attempt to fix an OSX crash when manipulating the ImGui sliders

This commit is contained in:
Lukas Matena 2019-03-04 09:41:25 +01:00
parent ee4496f59f
commit 9c5194c89b
4 changed files with 21 additions and 7 deletions

View file

@ -2365,8 +2365,10 @@ RENDER_AGAIN:
}
if (value_changed) { // Update side panel
wxGetApp().obj_settings()->UpdateAndShow(true);
wxGetApp().obj_list()->update_settings_items();
wxTheApp->CallAfter([]() {
wxGetApp().obj_settings()->UpdateAndShow(true);
wxGetApp().obj_list()->update_settings_items();
});
}
bool generate = m_imgui->button(_(L("Auto-generate points [A]")));
@ -2400,7 +2402,7 @@ RENDER_AGAIN:
if (remove_selected || remove_all) {
force_refresh = false;
m_parent.reload_scene(true);
m_parent.set_as_dirty();
if (remove_all)
select_point(AllPoints);
delete_selected_points(remove_all);
@ -2413,7 +2415,7 @@ RENDER_AGAIN:
}
if (force_refresh)
m_parent.reload_scene(true);
m_parent.set_as_dirty();
}
#endif // ENABLE_IMGUI

View file

@ -376,7 +376,8 @@ void ObjectList::selection_changed()
fix_multiselection_conflicts();
// update object selection on Plater
update_selections_on_canvas();
if (!m_prevent_canvas_selection_update)
update_selections_on_canvas();
// to update the toolbar and info sizer
if (!GetSelection() || m_objects_model->GetItemType(GetSelection()) == itObject) {
@ -2129,6 +2130,10 @@ bool ObjectList::has_multi_part_objects()
void ObjectList::update_settings_items()
{
m_prevent_canvas_selection_update = true;
wxDataViewItemArray sel;
GetSelections(sel); // stash selection
wxDataViewItemArray items;
m_objects_model->GetChildren(wxDataViewItem(0), items);
@ -2136,7 +2141,9 @@ void ObjectList::update_settings_items()
const wxDataViewItem& settings_item = m_objects_model->GetSettingsItem(item);
select_item(settings_item ? settings_item : m_objects_model->AddSettingsChild(item));
}
UnselectAll();
// restore selection:
SetSelections(sel);
m_prevent_canvas_selection_update = false;
}
void ObjectList::update_object_menu()

View file

@ -127,6 +127,10 @@ class ObjectList : public wxDataViewCtrl
bool m_prevent_update_extruder_in_config = false; // We use this flag to avoid updating of the extruder value in config
// during updating of the extruder count.
bool m_prevent_canvas_selection_update = false; // This flag prevents changing selection on the canvas. See function
// update_settings_items - updating canvas selection is undesirable,
// because it would turn off the gizmos (mainly a problem for the SLA gizmo)
bool m_parts_changed = false;
bool m_part_settings_changed = false;

View file

@ -191,7 +191,8 @@ void View3D::reload_scene(bool refresh_immediately, bool force_full_scene_refres
void View3D::render()
{
if (m_canvas != nullptr)
m_canvas->render();
//m_canvas->render();
m_canvas->set_as_dirty();
}
Preview::Preview(wxWindow* parent, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process_func)