diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 78c907bc9..c60585854 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -722,17 +722,7 @@ MachineObject::~MachineObject() model_task = 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; - } + free_slice_info(); for (auto it = amsList.begin(); it != amsList.end(); it++) { for (auto tray_it = it->second->trayList.begin(); tray_it != it->second->trayList.end(); tray_it++) { @@ -5545,10 +5535,6 @@ void MachineObject::set_modeltask(BBLModelTask* task) model_task = task; } -void MachineObject::set_slice_info(BBLSliceInfo *info) { - slice_info = info; -} - void MachineObject::update_model_task() { if (request_model_result > 10) return; @@ -5646,6 +5632,27 @@ void MachineObject::update_model_task() }); } +void MachineObject::free_slice_info() +{ + if (get_slice_info_thread) + { + if (get_slice_info_thread->joinable()) + { + get_slice_info_thread->interrupt(); + get_slice_info_thread->join(); + } + + delete get_slice_info_thread; + get_slice_info_thread = nullptr; + } + + if (slice_info) + { + delete slice_info; + slice_info = nullptr; + } +} + void MachineObject::update_slice_info(std::string project_id, std::string profile_id, std::string subtask_id, int plate_idx) { if (!m_agent) return; @@ -5671,6 +5678,8 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil int plate_index = -1; if (!m_agent) return; + if (!slice_info) return; + if (get_slice_info_thread->interruption_requested()) { return;} if (plate_idx >= 0) { plate_index = plate_idx; diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 64b407f37..acf5e8c38 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -1302,8 +1302,10 @@ public: BBLSubTask* get_subtask(); BBLModelTask* get_modeltask(); void set_modeltask(BBLModelTask* task); - void set_slice_info(BBLSliceInfo *info); + void update_model_task(); + + void free_slice_info(); void update_slice_info(std::string project_id, std::string profile_id, std::string subtask_id, int plate_idx); bool m_firmware_valid { false }; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index f9c9fe8a6..1a3809df8 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -2811,8 +2811,7 @@ void SelectMachineDialog::on_print_job_cancel(wxCommandEvent &evt) BOOST_LOG_TRIVIAL(info) << "print_job: canceled"; if (m_print_job && m_print_job->get_print_stage() == PrintingStageFinished) { - MessageDialog dlg(this, _L("As the print job has been successfully sent, the cancellation will not bring the print job to a halt. If you need to terminate this job, please stop it in 'Device' page."), _L("Info"), wxYES); - dlg.ShowModal(); + wxGetApp().show_dialog(_L("As the print job has been successfully sent, the cancellation will not bring the print job to a halt. If you need to terminate this job, please stop it in 'Device' page.")); } EnableEditing(true); diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index c7f4e3cfa..6fe9dd90a 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -3790,7 +3790,7 @@ void StatusPanel::update_cloud_subtask(MachineObject *obj) if (is_task_changed(obj)) { obj->set_modeltask(nullptr); - obj->set_slice_info(nullptr); + obj->free_slice_info(); reset_printing_values(); BOOST_LOG_TRIVIAL(info) << "monitor: change to sub task id = " << obj->subtask_->task_id; if (web_request.IsOk() && web_request.GetState() == wxWebRequest::State_Active) {