From 5ea08323e421f6e1dbbf3154f3a0baa2e4ffbd21 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 16 Apr 2024 22:09:00 -0400 Subject: [PATCH] Fix memory leak in patch::Manager::~Manager() is running in safe mode. --- src/patch.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/patch.cpp b/src/patch.cpp index 1784eddf..861e0aa4 100644 --- a/src/patch.cpp +++ b/src/patch.cpp @@ -47,16 +47,16 @@ Manager::~Manager() { // In safe mode, delete autosave dir. if (settings::safeMode) { clearAutosave(); - return; } - - // Dispatch onSave to all Modules so they save their patch storage, etc. - APP->engine->prepareSave(); - // Save autosave if not headless - if (!settings::headless) { - APP->patch->saveAutosave(); + else { + // Dispatch onSave to all Modules so they save their patch storage, etc. + APP->engine->prepareSave(); + // Save autosave if not headless + if (!settings::headless) { + APP->patch->saveAutosave(); + } + cleanAutosave(); } - cleanAutosave(); delete internal; }