From e1ac2c685979e023fbc74321b2a4892fcef6733c Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 7 Dec 2021 20:16:06 -0500 Subject: [PATCH] Clear patch when loading before clearing autosave, since modules in the patch could hold handles to patch storage when clearing. --- src/patch.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/patch.cpp b/src/patch.cpp index a7344070..e848d8f2 100644 --- a/src/patch.cpp +++ b/src/patch.cpp @@ -248,6 +248,8 @@ static bool isPatchLegacyV1(std::string path) { void Manager::load(std::string path) { INFO("Loading patch %s", path.c_str()); + clear(); + system::removeRecursively(autosavePath); system::createDirectories(autosavePath); @@ -268,6 +270,8 @@ void Manager::load(std::string path) { void Manager::loadTemplate() { + clear(); + try { load(templatePath); } @@ -282,7 +286,6 @@ void Manager::loadTemplate() { system::removeRecursively(autosavePath); system::createDirectories(autosavePath); - clear(); } }