From 2be3c9f8678d8527ddab77a300e52510e8b7f10c Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 14 Nov 2024 12:10:45 +0100 Subject: [PATCH] Couple more ad-hoc fixes for crashes on startup --- src/slic3r/GUI/PresetArchiveDatabase.cpp | 2 +- src/slic3r/Utils/PresetUpdater.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/PresetArchiveDatabase.cpp b/src/slic3r/GUI/PresetArchiveDatabase.cpp index 46d529ca7c..b76d6bc802 100644 --- a/src/slic3r/GUI/PresetArchiveDatabase.cpp +++ b/src/slic3r/GUI/PresetArchiveDatabase.cpp @@ -184,7 +184,7 @@ std::string escape_path_by_element(const std::string& path_string) bool add_authorization_header(Http& http) { - if (wxApp::GetInstance() == nullptr) + if (wxApp::GetInstance() == nullptr || ! GUI::wxGetApp().plater()) return false; const std::string access_token = GUI::wxGetApp().plater()->get_user_account()->get_access_token(); if (!access_token.empty()) { diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index fcfc824305..f23ac74b11 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -1186,6 +1186,11 @@ PresetUpdater::UpdateResult PresetUpdater::config_update(const Semver& old_slic3 } } + if (!wxApp::GetInstance() || ! GUI::wxGetApp().plater()) { + // The main thread might have start killing the UI. + return R_NOOP; + } + // regular update if (params == UpdateParams::SHOW_NOTIFICATION) { p->set_waiting_updates(updates);