FIX: fix crash when cancel print job

join print_job thread in prepare_mode()

Change-Id: I5af749655f36ac5b67e3c29bd909bd67a71bfb55
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-08-05 11:13:21 +08:00 committed by Lane.Wei
parent 97de939674
commit f001092dc3

View file

@ -1035,6 +1035,12 @@ void SelectMachineDialog::update_select_layout(PRINTER_TYPE type)
void SelectMachineDialog::prepare_mode() void SelectMachineDialog::prepare_mode()
{ {
if (m_print_job) {
m_print_job->join();
}
wxEndBusyCursor();
Enable_Send_Button(true);
m_status_bar->reset(); m_status_bar->reset();
if (m_simplebook->GetSelection() != 0) { if (m_simplebook->GetSelection() != 0) {
m_simplebook->SetSelection(0); m_simplebook->SetSelection(0);
@ -1430,6 +1436,8 @@ void SelectMachineDialog::on_cancel(wxCloseEvent &event)
void SelectMachineDialog::on_ok(wxCommandEvent &event) void SelectMachineDialog::on_ok(wxCommandEvent &event)
{ {
Enable_Send_Button(false);
int result = 0; int result = 0;
if (m_printer_last_select.empty()) { if (m_printer_last_select.empty()) {
return; return;