mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-21 09:52:11 +00:00
Prevent script execution during shutdown
Skip script action calls when the application is closing to avoid post-teardown issues.
This commit is contained in:
@@ -270,10 +270,14 @@ private:
|
|||||||
}
|
}
|
||||||
// why: value-capture only. Script execution may outlive this popup if the app is closing.
|
// why: value-capture only. Script execution may outlive this popup if the app is closing.
|
||||||
wxGetApp().CallAfter([id] {
|
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);
|
AppActionRunResult o = wxGetApp().action_registry().run(id);
|
||||||
if (o.level == AppActionRunResult::Level::Busy)
|
if (o.level == AppActionRunResult::Level::Busy)
|
||||||
return;
|
return;
|
||||||
if (!o.message.IsEmpty())
|
if (!o.message.IsEmpty() && wxGetApp().plater())
|
||||||
wxGetApp().plater()->get_notification_manager()->push_notification(
|
wxGetApp().plater()->get_notification_manager()->push_notification(
|
||||||
NotificationType::CustomNotification,
|
NotificationType::CustomNotification,
|
||||||
o.level == AppActionRunResult::Level::Error ? NotificationManager::NotificationLevel::ErrorNotificationLevel :
|
o.level == AppActionRunResult::Level::Error ? NotificationManager::NotificationLevel::ErrorNotificationLevel :
|
||||||
|
|||||||
Reference in New Issue
Block a user