diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 10d6bc2876..90fe62a1e2 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -349,6 +350,17 @@ public: } } + // Orca: keep the splash alive until it is explicitly destroyed. + // wxSplashScreen installs an application-wide event filter that calls + // Close() (which Destroy()s the window) on ANY key press or mouse-button + // down. Since startup keeps the splash up across the whole load_presets() + // and main-window-creation phase, a single stray click/keypress would + // destroy it while on_init_inner() still holds the pointer, causing an + // intermittent use-after-free crash. Override the filter to a no-op so the + // splash can only be removed via the explicit Destroy() once the main frame + // is shown. + int FilterEvent(wxEvent& /*event*/) override { return wxEventFilter::Event_Skip; } + void scale_font(wxFont& font, float scale) { #ifdef __WXMSW__ @@ -2763,7 +2775,8 @@ bool GUI_App::on_init_inner() app_config->set("version", SLIC3R_VERSION); } - SplashScreen * scrn = nullptr; + // Orca: use wxWeakRef to provent wild pointer. + wxWeakRef scrn = nullptr; if (app_config->get("show_splash_screen") == "true") { // Detect position (display) to show the splash screen // Now this position is equal to the mainframe position