mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-09 18:27:00 +00:00
Fixed an random crash on start on Linux (#14052)
This commit is contained in:
@@ -61,6 +61,7 @@
|
|||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
#include <wx/splash.h>
|
#include <wx/splash.h>
|
||||||
|
#include <wx/weakref.h>
|
||||||
#include <wx/fontutil.h>
|
#include <wx/fontutil.h>
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
#include <wx/utils.h>
|
#include <wx/utils.h>
|
||||||
@@ -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)
|
void scale_font(wxFont& font, float scale)
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
@@ -2763,7 +2775,8 @@ bool GUI_App::on_init_inner()
|
|||||||
app_config->set("version", SLIC3R_VERSION);
|
app_config->set("version", SLIC3R_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
SplashScreen * scrn = nullptr;
|
// Orca: use wxWeakRef to provent wild pointer.
|
||||||
|
wxWeakRef<SplashScreen> scrn = nullptr;
|
||||||
if (app_config->get("show_splash_screen") == "true") {
|
if (app_config->get("show_splash_screen") == "true") {
|
||||||
// Detect position (display) to show the splash screen
|
// Detect position (display) to show the splash screen
|
||||||
// Now this position is equal to the mainframe position
|
// Now this position is equal to the mainframe position
|
||||||
|
|||||||
Reference in New Issue
Block a user