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.
This commit is contained in:
HanifKoh authored and GitHub committed 2026-10-30 12:49:51 +08:00
1 parent 29e1899571
commit efe735853a
2 files changed
+5 -1

No files matched your search

@@ -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<std::mutex> lock(m_print->state_mutex());
this->invalidate_step(bspsGCodeFinalize);
+1 -1
View File
@@ -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(); }