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 <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-07-27 17:27:36 +08:00 committed by Lane.Wei
parent a0e2e1e62d
commit 45d2081a08

View file

@ -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) {