diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index bcefd4bd7f..89ee926292 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -361,6 +361,13 @@ MachineObject::~MachineObject() subtask_ = nullptr; } + if (get_slice_info_thread) { + if (get_slice_info_thread->joinable()) { + get_slice_info_thread->join(); + get_slice_info_thread = nullptr; + } + } + if (slice_info) { delete slice_info; slice_info = nullptr; @@ -2474,7 +2481,7 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil BOOST_LOG_TRIVIAL(trace) << "slice_info: start"; slice_info = new BBLSliceInfo(); - auto get_slice_info_thread = boost::thread([this, project_id, profile_id, subtask_id, plate_idx] { + get_slice_info_thread = new boost::thread([this, project_id, profile_id, subtask_id, plate_idx] { int plate_index = -1; if (!m_agent) return; diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 6718fe8b3d..ecc12b5b8d 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -479,6 +479,8 @@ public: std::string task_id_; std::string subtask_id_; BBLSliceInfo* slice_info {nullptr}; + boost::thread* get_slice_info_thread { nullptr }; + int plate_index { -1 }; std::string m_gcode_file; int gcode_file_prepare_percent = 0;