Implement exception rethrow for ui jobs

This commit is contained in:
tamasmeszaros 2021-01-19 15:00:44 +01:00
parent 264ce71e94
commit 56e7d83513
11 changed files with 112 additions and 51 deletions

View file

@ -2,6 +2,7 @@
#define JOB_HPP
#include <atomic>
#include <exception>
#include "libslic3r/libslic3r.h"
@ -32,8 +33,9 @@ class Job : public wxEvtHandler
std::atomic<bool> m_running{false}, m_canceled{false};
bool m_finalized = false;
std::shared_ptr<ProgressIndicator> m_progress;
std::exception_ptr m_worker_error = nullptr;
void run();
void run(std::exception_ptr &);
protected:
// status range for a particular job
@ -49,6 +51,8 @@ protected:
// Launched when the job is finished. It refreshes the 3Dscene by def.
virtual void finalize() { m_finalized = true; }
virtual void on_exception(const std::exception_ptr &) {}
public:
Job(std::shared_ptr<ProgressIndicator> pri);