From 36fb9905e5f99fc2bb1a1beef51c1acb9866c7dc Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Sat, 3 Oct 2026 20:40:33 -0500 Subject: [PATCH] fix: Linux Flatpak freeze and blank toolpaths after changing a setting in Preview (#16109) --- src/slic3r/GUI/GLCanvas3D.cpp | 5 ++++- src/slic3r/GUI/GLCanvas3D.hpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 622568e291..22ff3140a0 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2491,7 +2491,7 @@ void GLCanvas3D::render_thumbnail(ThumbnailData & thumbnail_data, bool GLCanvas3D::_set_shown_canvas_current() { - // Thumbnails also render outside render(), where another library's GL context (e.g. WebKitGTK's) can be current. + // Called before GL work outside render(), where another library's GL context (e.g. WebKitGTK's) can be current. // Inside render(), the shown canvas is the one already bound. return wxGetApp().plater()->get_current_canvas3D()->_set_current(); } @@ -3329,6 +3329,7 @@ void GLCanvas3D::load_shells(const Print& print, bool force_previewing) { if (m_initialized) { + _set_shown_canvas_current(); m_gcode_viewer.load_shells(print, m_initialized, force_previewing); m_gcode_viewer.update_shells_color_by_extruder(m_config); } @@ -3345,6 +3346,8 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co PartPlate* plate = partplate_list.get_curr_plate(); const std::vector& exclude_bounding_box = plate->get_exclude_areas(); + _set_shown_canvas_current(); + //BBS: init is called in GLCanvas3D.render() //when load gcode directly, it is too late m_gcode_viewer.init(wxGetApp().get_mode(), wxGetApp().preset_bundle); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 9bb2d68b42..85d541ec5e 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -912,7 +912,7 @@ public: //BBS GCodeViewer& get_gcode_viewer() { return m_gcode_viewer; } void init_gcode_viewer(ConfigOptionMode mode, Slic3r::PresetBundle* preset_bundle) { m_gcode_viewer.init(mode, preset_bundle); } - void reset_gcode_toolpaths() { m_gcode_viewer.reset(); } + void reset_gcode_toolpaths() { _set_shown_canvas_current(); m_gcode_viewer.reset(); } const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); } void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); } const libvgcode::Interval& get_gcode_view_full_range() const { return m_gcode_viewer.get_gcode_view_full_range(); }