From 45d2081a0880a4db8ed386b0b8b5abc88afc6520 Mon Sep 17 00:00:00 2001 From: Stone Li Date: Wed, 27 Jul 2022 17:27:36 +0800 Subject: [PATCH] FIX: fix crash when return HTTP 401 cause: we call wx widget before GUI_App Created set_on_http_error_fn in post_init() Change-Id: I1fcec76bc9472288315b3cc29c651a929fcc749d Signed-off-by: Stone Li --- src/slic3r/GUI/GUI_App.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 96dbbabf0..4a4933355 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1066,6 +1066,9 @@ void GUI_App::post_init() }); } ); + m_agent->set_on_http_error_fn([this](unsigned int status, std::string body) { + this->handle_http_error(status, body); + }); m_agent->start_discovery(true, false); } @@ -1421,6 +1424,9 @@ void GUI_App::restart_networking() }); } ); + m_agent->set_on_http_error_fn([this](unsigned int status, std::string body) { + this->handle_http_error(status, body); + }); m_agent->start_discovery(true, false); if (mainframe) mainframe->refresh_plugin_tips(); @@ -1539,10 +1545,6 @@ void GUI_App::init_networking_callbacks() } ); - m_agent->set_on_http_error_fn([this](unsigned int status, std::string body) { - this->handle_http_error(status, body); - }); - auto message_arrive_fn = [this](std::string dev_id, std::string msg) { CallAfter([this, dev_id, msg] { if (m_is_closing) {