diff --git a/src/libslic3r/PrintBase.cpp b/src/libslic3r/PrintBase.cpp index 7ae5b1f9f7..a44f42fbdd 100644 --- a/src/libslic3r/PrintBase.cpp +++ b/src/libslic3r/PrintBase.cpp @@ -15,9 +15,4 @@ std::function PrintObjectBase::cancel_callback(PrintBase *print) return print->cancel_callback(); } -void PrintObjectBase::throw_if_canceled(PrintBase *print) -{ - print->throw_if_canceled(); -} - } // namespace Slic3r diff --git a/src/libslic3r/PrintBase.hpp b/src/libslic3r/PrintBase.hpp index 435b50dd3d..94c732c0b7 100644 --- a/src/libslic3r/PrintBase.hpp +++ b/src/libslic3r/PrintBase.hpp @@ -190,9 +190,6 @@ protected: // Declared here to allow access from PrintBase through friendship. static tbb::mutex& state_mutex(PrintBase *print); static std::function cancel_callback(PrintBase *print); - // If the background processing stop was requested, throw CanceledException. - // To be called by the worker thread and its sub-threads (mostly launched on the TBB thread pool) regularly. - static void throw_if_canceled(PrintBase *print); ModelObject *m_model_object; }; @@ -353,9 +350,9 @@ protected: PrintObjectBaseWithState(PrintType *print, ModelObject *model_object) : PrintObjectBase(model_object), m_print(print) {} bool set_started(PrintObjectStepEnum step) - { return m_state.set_started(step, PrintObjectBase::state_mutex(m_print), [this](){ PrintObjectBase::throw_if_canceled(this->m_print); }); } + { return m_state.set_started(step, PrintObjectBase::state_mutex(m_print), [this](){ this->throw_if_canceled(); }); } PrintStateBase::TimeStamp set_done(PrintObjectStepEnum step) - { return m_state.set_done(step, PrintObjectBase::state_mutex(m_print), [this](){ PrintObjectBase::throw_if_canceled(this->m_print); }); } + { return m_state.set_done(step, PrintObjectBase::state_mutex(m_print), [this](){ this->throw_if_canceled(); }); } bool invalidate_step(PrintObjectStepEnum step) { return m_state.invalidate(step, PrintObjectBase::cancel_callback(m_print)); } @@ -368,6 +365,10 @@ protected: { return m_state.invalidate_all(PrintObjectBase::cancel_callback(m_print)); } protected: + // If the background processing stop was requested, throw CanceledException. + // To be called by the worker thread and its sub-threads (mostly launched on the TBB thread pool) regularly. + void throw_if_canceled() { if (m_print->canceled()) throw CanceledException(); } + friend PrintType; PrintType *m_print;