From ab85578dce442b80aa3378fe0304e6cb6f16f593 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 28 Nov 2022 11:43:08 +0000 Subject: [PATCH] fix crash with unloadAll --- src/config/ConfigManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 7e06579..b6bfbb2 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -180,6 +180,8 @@ void CConfigManager::handleUnload(const std::string& COMMAND, const std::string& } void CConfigManager::handleUnloadAll(const std::string& COMMAND, const std::string& VALUE) { + std::vector toUnload; + for (auto&[name, target] : g_pHyprpaper->m_mWallpaperTargets) { bool exists = false; @@ -193,6 +195,9 @@ void CConfigManager::handleUnloadAll(const std::string& COMMAND, const std::stri if (exists) continue; - g_pHyprpaper->unloadWallpaper(name); + toUnload.emplace_back(name); } + + for (auto& tu : toUnload) + g_pHyprpaper->unloadWallpaper(tu); }