mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
FIX: fix crash in update_slice_info
join update_slice_info thread when destroy the MachineObject Change-Id: I9f22cf5445ef9426651a8affa799da03b7456015 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
36be714ed4
commit
ed36024efa
2 changed files with 10 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue