mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-14 04:21:50 +08:00
Prevent accidental stopping of BoostThreadWorker before destruction
This commit is contained in:
parent
2b25c6fab2
commit
a802bdc764
@ -94,9 +94,9 @@ constexpr int ABORT_WAIT_MAX_MS = 10000;
|
|||||||
|
|
||||||
BoostThreadWorker::~BoostThreadWorker()
|
BoostThreadWorker::~BoostThreadWorker()
|
||||||
{
|
{
|
||||||
replace_job(*this, nullptr);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
cancel_all();
|
||||||
|
m_input_queue.push(JobEntry{nullptr});
|
||||||
join(ABORT_WAIT_MAX_MS);
|
join(ABORT_WAIT_MAX_MS);
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
BOOST_LOG_TRIVIAL(error)
|
BOOST_LOG_TRIVIAL(error)
|
||||||
@ -130,8 +130,10 @@ void BoostThreadWorker::process_events()
|
|||||||
|
|
||||||
bool BoostThreadWorker::start_next(std::unique_ptr<Job> job)
|
bool BoostThreadWorker::start_next(std::unique_ptr<Job> job)
|
||||||
{
|
{
|
||||||
|
if (job)
|
||||||
m_input_queue.push(JobEntry{std::move(job)});
|
m_input_queue.push(JobEntry{std::move(job)});
|
||||||
return true;
|
|
||||||
|
return bool{job};
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user