From ea97a9aa33d31a30abe3e4823302d86664b106d4 Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Tue, 4 Jul 2023 18:02:25 +0800 Subject: [PATCH] FIX: [STUDIO-3532] cancel web request on unbind dialog Change-Id: I4830dcc32de4daec47066539bb8eaa12a51adfbd --- src/slic3r/GUI/BindDialog.cpp | 7 ++++--- src/slic3r/GUI/BindDialog.hpp | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/BindDialog.cpp b/src/slic3r/GUI/BindDialog.cpp index bf27a7c9d..d24853fc6 100644 --- a/src/slic3r/GUI/BindDialog.cpp +++ b/src/slic3r/GUI/BindDialog.cpp @@ -804,6 +804,7 @@ UnBindMachineDialog::UnBindMachineDialog(Plater *plater /*= nullptr*/) UnBindMachineDialog::~UnBindMachineDialog() { + web_request.Cancel(); m_button_unbind->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(UnBindMachineDialog::on_unbind_printer), NULL, this); m_button_cancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(UnBindMachineDialog::on_cancel), NULL, this); } @@ -873,11 +874,11 @@ void UnBindMachineDialog::on_show(wxShowEvent &event) wxString username_text = from_u8(wxGetApp().getAgent()->get_user_name()); m_user_name->SetLabelText(username_text); wxString avatar_url = wxGetApp().getAgent()->get_user_avatar(); - wxWebRequest request = wxWebSession::GetDefault().CreateRequest(this, avatar_url); - if (!request.IsOk()) { + web_request = wxWebSession::GetDefault().CreateRequest(this, avatar_url); + if (!web_request.IsOk()) { // todo request fail } - request.Start(); + web_request.Start(); } Layout(); diff --git a/src/slic3r/GUI/BindDialog.hpp b/src/slic3r/GUI/BindDialog.hpp index 8a429d58b..f66f1e7cf 100644 --- a/src/slic3r/GUI/BindDialog.hpp +++ b/src/slic3r/GUI/BindDialog.hpp @@ -108,6 +108,7 @@ protected: MachineObject *m_machine_info{nullptr}; wxStaticBitmap *m_avatar; wxStaticBitmap *m_printer_img; + wxWebRequest web_request; public: UnBindMachineDialog(Plater *plater = nullptr);