From 937437907d51d721107da223edc28eabdfb95b2d Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sat, 29 Aug 2026 18:38:45 +0800 Subject: [PATCH] Use Plater's existing background_process() accessor It was already public and used elsewhere, so the new get_background_process() and its duplicate forward declaration were redundant; Plater.hpp is now untouched. --- src/slic3r/GUI/CAD/DesignCanvas.cpp | 7 +++---- src/slic3r/GUI/Plater.cpp | 5 ----- src/slic3r/GUI/Plater.hpp | 5 ----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/slic3r/GUI/CAD/DesignCanvas.cpp b/src/slic3r/GUI/CAD/DesignCanvas.cpp index 4dbff59959..b614c23be1 100644 --- a/src/slic3r/GUI/CAD/DesignCanvas.cpp +++ b/src/slic3r/GUI/CAD/DesignCanvas.cpp @@ -39,10 +39,9 @@ DesignCanvas::DesignCanvas(wxWindow* parent) m_canvas->allow_multisample(OpenGLManager::can_multisample()); m_canvas->set_config(wxGetApp().plater()->config()); m_canvas->set_model(&m_model); - // Reuse the editor's shared slicing process: GLCanvas3D::render() (via - // _max_bounding_box) dereferences the process when canvas type == View3D. - // Passing nullptr segfaults; this mirrors View3D/Preview/AssembleView. - m_canvas->set_process(wxGetApp().plater()->get_background_process()); + // Nothing to slice here, but GLCanvas3D derefs the process unguarded every frame, so it + // cannot be null. Borrow the plater's, as the editor canvases do. + m_canvas->set_process(&wxGetApp().plater()->background_process()); m_canvas->set_type(GLCanvas3D::ECanvasType::CanvasView3D); // CAD navigation, this canvas only: left-drag sweeps a selection rubber band, so orbit diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 962c7b7cc4..c67abdfa6f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -20649,11 +20649,6 @@ PartPlateList& Plater::get_partplate_list() return p->partplate_list; } -BackgroundSlicingProcess* Plater::get_background_process() -{ - return &p->background_process; -} - void Plater::apply_background_progress() { PartPlate* part_plate = p->partplate_list.get_curr_plate(); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index a41d309f4f..5308deec61 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -47,7 +47,6 @@ class Model; class ModelObject; class ModelInstance; class Print; -class BackgroundSlicingProcess; class SLAPrint; //BBS: add partplatelist and SlicingStatusEvent class PartPlateList; @@ -750,10 +749,6 @@ public: //BBS: partplate list related functions PartPlateList& get_partplate_list(); - // Shared background slicing process (same instance View3D/Preview/AssembleView - // use). Exposed so the Design tab's native GLCanvas3D can be wired exactly like - // the editor canvases (GLCanvas3D::render() dereferences the process). - BackgroundSlicingProcess* get_background_process(); void validate_current_plate(bool& model_fits, bool& validate_error); // Rebuild the missing-plugin sets from the active presets and (re)show/close their notifications. // Returns true when slicing must be blocked (a referenced plugin is still missing); sets