diff --git a/src/slic3r/GUI/Jobs/Worker.hpp b/src/slic3r/GUI/Jobs/Worker.hpp index f9476152e..0bc7bc086 100644 --- a/src/slic3r/GUI/Jobs/Worker.hpp +++ b/src/slic3r/GUI/Jobs/Worker.hpp @@ -100,18 +100,18 @@ template bool replace_job(Worker &w, Args&& ...args) } // Cancel the current job and wait for it to actually be stopped. -inline void stop_current_job(Worker &w, unsigned timeout_ms = 0) +inline bool stop_current_job(Worker &w, unsigned timeout_ms = 0) { w.cancel(); - w.wait_for_current_job(timeout_ms); + return w.wait_for_current_job(timeout_ms); } // Cancel all pending jobs including current one and wait until the worker // becomes idle. -inline void stop_queue(Worker &w, unsigned timeout_ms = 0) +inline bool stop_queue(Worker &w, unsigned timeout_ms = 0) { w.cancel_all(); - w.wait_for_idle(timeout_ms); + return w.wait_for_idle(timeout_ms); } }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 90de37784..feb39b9ca 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5892,8 +5892,14 @@ void Plater::reslice() if (canvas3D()->get_gizmos_manager().is_in_editing_mode(true)) return; - // Stop arrange and (or) optimize rotation tasks. - stop_queue(this->get_ui_job_worker()); + // Stop the running (and queued) UI jobs and only proceed if they actually + // get stopped. + unsigned timeout_ms = 10000; + if (!stop_queue(this->get_ui_job_worker(), timeout_ms)) { + BOOST_LOG_TRIVIAL(error) << "Could not stop UI job within " + << timeout_ms << " milliseconds timeout!"; + return; + } if (printer_technology() == ptSLA) { for (auto& object : model().objects)