FIX: fix crash and blank page while cancel printing at 75 percent

jira: [STUDIO-11861]
Change-Id: I142df41ade73558849183fd245163cb5a7367f9c
This commit is contained in:
xin.zhang 2025-04-25 12:21:35 +08:00 committed by lane.wei
parent 1586835c59
commit ddf4e9bc9f
4 changed files with 29 additions and 19 deletions

View File

@ -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;

View File

@ -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 };

View File

@ -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);

View File

@ -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) {