From efe735853a1bc14e6665c2bddefebe5aa2cb4c80 Mon Sep 17 00:00:00 2001 From: HanifKoh <76276251+HanifKoh@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:49:51 +0800 Subject: [PATCH] Drop a Scheduled Print Host Upload When the Slice Ends Before It Is Queued (#17016) A print host job scheduled by Print is moved into the print host job queue at the end of prepare_upload(). When the run ended before that point, because a post-processing script or a slicing-pipeline plugin failed in upload mode, or because the slice was cancelled, the job stayed in m_upload_job. Every later plain slice, even in a new project, then ran prepare_upload() again with the first job's output name and uploaded (and printed) the file although only Slice was pressed, until an upload succeeded or OrcaSlicer was restarted. reset_export() runs after every completed, failed or cancelled slice and on a new project, and already clears the export path for the same reason. Clear the scheduled upload there as well. --- src/slic3r/GUI/BackgroundSlicingProcess.cpp | 4 ++++ src/slic3r/GUI/BackgroundSlicingProcess.hpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 602464bb86..e1dc565874 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -807,6 +807,10 @@ void BackgroundSlicingProcess::reset_export() if (!this->running()) { m_export_path.clear(); m_export_path_on_removable_media = false; + // A scheduled upload only leaves m_upload_job when prepare_upload() hands it to the print host + // job queue. If the run ended before that (a post-processing script or plugin failure, or a + // cancel), the job must not survive into the next plain slice, which would upload again. + m_upload_job = PrintHostJob(); // invalidate_step expects the mutex to be locked. std::scoped_lock lock(m_print->state_mutex()); this->invalidate_step(bspsGCodeFinalize); diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.hpp b/src/slic3r/GUI/BackgroundSlicingProcess.hpp index 231bee811e..1ccd821190 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.hpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.hpp @@ -166,7 +166,7 @@ public: // Set print host upload job data to be enqueued to the PrintHostJobQueue // after current print slicing is complete void schedule_upload(Slic3r::PrintHostJob upload_job); - // Clear m_export_path. + // Clear m_export_path and drop a scheduled upload that was not handed to the print host job queue. void reset_export(); // Once the G-code export is scheduled, the apply() methods will do nothing. bool is_export_scheduled() const { return ! m_export_path.empty(); }