From c4c670c995f2c804d9e0bf44ba29e6f038ac03d2 Mon Sep 17 00:00:00 2001 From: tao wang Date: Thu, 17 Oct 2024 10:08:47 +0800 Subject: [PATCH] FIX:fix the issue of macOS crashing easily jira:[udesk 7578206] Change-Id: If5e0b2d0969ca70815a5d2c9cca71654c9e1817b (cherry picked from commit 8dfa6839e5e3a9bebb03616ff6d0c0c1699ad22f) --- src/slic3r/GUI/SelectMachine.cpp | 48 +++++++++++++++----------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index f99f93a609..caa5464dba 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -4685,6 +4685,22 @@ void SelectMachineDialog::sys_color_changed() bool SelectMachineDialog::Show(bool show) { + if (show) { + m_refresh_timer->Start(LIST_REFRESH_INTERVAL); + } else { + m_refresh_timer->Stop(); + + DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager(); + if (dev) { + MachineObject *obj_ = dev->get_selected_machine(); + if (obj_ && obj_->connection_type() == "cloud" /*&& m_print_type == FROM_SDCARD_VIEW*/) { + if (obj_->is_connected()) { obj_->disconnect(); } + } + } + + return DPIDialog::Show(false); + } + show_status(PrintDialogStatus::PrintStatusInit); PresetBundle& preset_bundle = *wxGetApp().preset_bundle; @@ -4715,34 +4731,16 @@ bool SelectMachineDialog::Show(bool show) else{ m_text_bed_type->Hide(); } - // set default value when show this dialog - if (show) { - m_refresh_timer->Start(LIST_REFRESH_INTERVAL); - show_status(PrintDialogStatus::PrintStatusInit); - wxGetApp().UpdateDlgDarkUI(this); - wxGetApp().reset_to_active(); - set_default(); - update_user_machine_list(); + wxGetApp().UpdateDlgDarkUI(this); + wxGetApp().reset_to_active(); + set_default(); + update_user_machine_list(); - Layout(); - Fit(); - CenterOnParent(); - } - else { - m_refresh_timer->Stop(); - DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); - if (dev) { - MachineObject* obj_ = dev->get_selected_machine(); - if (obj_ && obj_->connection_type() == "cloud" /*&& m_print_type == FROM_SDCARD_VIEW*/) { - if (obj_->is_connected()) { - obj_->disconnect(); - } - - } - } - } + Layout(); + Fit(); + CenterOnParent(); return DPIDialog::Show(show); }