mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 17:58:03 -06:00
FIX: fix crash when to press cancel button
it would crash when avatar of user is loading. cancel web request before closing dialog. Change-Id: Ib41c5d8e7b5663d15c7d7f544335b48f47c25fea Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
3aa3df00fc
commit
89c83fb8a6
2 changed files with 17 additions and 8 deletions
|
@ -92,12 +92,12 @@ namespace GUI {
|
|||
|
||||
m_avatar = new wxStaticBitmap(m_panel_right, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(FromDIP(60), FromDIP(60)), 0);
|
||||
|
||||
wxWebRequest request = wxWebSession::GetDefault().CreateRequest(this, wxGetApp().getAgent()->get_user_avatar());
|
||||
if (!request.IsOk()) {
|
||||
web_request = wxWebSession::GetDefault().CreateRequest(this, wxGetApp().getAgent()->get_user_avatar());
|
||||
if (!web_request.IsOk()) {
|
||||
// todo request fail
|
||||
}
|
||||
// Start the request
|
||||
request.Start();
|
||||
web_request.Start();
|
||||
}
|
||||
|
||||
m_sizer_right_v->Add(m_avatar, 0, wxALIGN_CENTER, 0);
|
||||
|
@ -209,19 +209,25 @@ namespace GUI {
|
|||
|
||||
void BindMachineDialog::on_cancel(wxCommandEvent &event)
|
||||
{
|
||||
if (m_bind_job) {
|
||||
m_bind_job->cancel();
|
||||
m_bind_job->join();
|
||||
}
|
||||
on_destroy();
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
|
||||
void BindMachineDialog::on_close(wxCloseEvent &event)
|
||||
void BindMachineDialog::on_destroy()
|
||||
{
|
||||
if (m_bind_job) {
|
||||
m_bind_job->cancel();
|
||||
m_bind_job->join();
|
||||
}
|
||||
|
||||
if (web_request.IsOk()) {
|
||||
web_request.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void BindMachineDialog::on_close(wxCloseEvent &event)
|
||||
{
|
||||
on_destroy();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue