From 3404d4ceceaa4d3761b6ab3c8a0bde8e90984cb8 Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Sat, 9 Aug 2025 11:45:13 +0100 Subject: [PATCH] app: destroy widgets in reverse order on exit as the widgets are a stack. --- sphaira/source/app.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sphaira/source/app.cpp b/sphaira/source/app.cpp index a6e8514..1233235 100644 --- a/sphaira/source/app.cpp +++ b/sphaira/source/app.cpp @@ -1974,7 +1974,10 @@ App::~App() { // this has to be called before any cleanup to ensure the lifetime of // nvg is still active as some widgets may need to free images. - m_widgets.clear(); + // clear in reverse order as the widgets are a stack (todo: just use a stack?) + while (!m_widgets.empty()) { + m_widgets.pop_back(); + } nvgDeleteImage(vg, m_default_image); i18n::exit();