From 476fa73e43fc83354cb01cfecbbfee149eee79a3 Mon Sep 17 00:00:00 2001 From: Andrew <159703254+andrewsoonqn@users.noreply.github.com> Date: Mon, 13 Jul 2026 19:20:23 +0800 Subject: [PATCH] Prevent script execution during shutdown Skip script action calls when the application is closing to avoid post-teardown issues. --- src/slic3r/GUI/SpeedDialDialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/SpeedDialDialog.cpp b/src/slic3r/GUI/SpeedDialDialog.cpp index 447d6a8dca..be34c9fce1 100644 --- a/src/slic3r/GUI/SpeedDialDialog.cpp +++ b/src/slic3r/GUI/SpeedDialDialog.cpp @@ -270,10 +270,14 @@ private: } // why: value-capture only. Script execution may outlive this popup if the app is closing. wxGetApp().CallAfter([id] { + // why: the queue may drain during shutdown, after MainFrame/Plater teardown; + // skip like the ScriptActionSource callbacks do instead of running into it. + if (wxGetApp().is_closing()) + return; AppActionRunResult o = wxGetApp().action_registry().run(id); if (o.level == AppActionRunResult::Level::Busy) return; - if (!o.message.IsEmpty()) + if (!o.message.IsEmpty() && wxGetApp().plater()) wxGetApp().plater()->get_notification_manager()->push_notification( NotificationType::CustomNotification, o.level == AppActionRunResult::Level::Error ? NotificationManager::NotificationLevel::ErrorNotificationLevel :