Prevent script execution during shutdown

Skip script action calls when the application
is closing to avoid post-teardown issues.
This commit is contained in:
Andrew
2026-07-13 19:20:23 +08:00
parent c3ebf38a07
commit 476fa73e43

View File

@@ -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 :