diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 5bfdea07dc..563df3245a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -10060,6 +10060,12 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning) void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) { + // On app quit the Plater pImpl (p) is freed before its child GLCanvas3D windows are + // destroyed; reset_volumes() -> _set_warning_notification() -> get_notification_manager() + // would then dereference the freed p (use-after-free crash on exit). No warning + // notifications are needed while the app is closing. + if (wxGetApp().is_closing()) + return; using NotificationLevel = NotificationManager::NotificationLevel; enum ErrorType{ PLATER_WARNING, diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 8452b8222c..7521334956 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -760,6 +760,12 @@ void Selection::clear() #endif // #et_FIXME fake KillFocus from sidebar + // On app quit the Plater's child GLCanvas3D windows are destroyed by the wxWindow + // base destructor *after* Plater's pImpl (p) has already been freed. reset_volumes() + // -> Selection::clear() then reaches back into plater()->canvas3D(), a use-after-free + // that crashes on exit. This is a UI-only redraw hint, so skip it while closing. + if (wxGetApp().is_closing()) + return; wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event("", false); }