fix logic in buffer cleaning

This commit is contained in:
vaxerski 2022-07-18 12:31:20 +02:00
parent 88885b21a9
commit f75fcf01d1
1 changed files with 4 additions and 5 deletions

View File

@ -82,10 +82,12 @@ void CHyprpaper::unloadWallpaper(const std::string& path) {
} }
// clean buffers // clean buffers
for (auto it = m_vBuffers.begin(); it != m_vBuffers.end(); it++) { for (auto it = m_vBuffers.begin(); it != m_vBuffers.end();) {
if (it->get()->target != path) if (it->get()->target != path) {
it++;
continue; continue;
}
const auto PRELOADPATH = it->get()->name; const auto PRELOADPATH = it->get()->name;
@ -96,9 +98,6 @@ void CHyprpaper::unloadWallpaper(const std::string& path) {
destroyBuffer(it->get()); destroyBuffer(it->get());
it = m_vBuffers.erase(it); it = m_vBuffers.erase(it);
if (it == m_vBuffers.end())
break;
} }
m_mWallpaperTargets.erase(path); // will free the cairo surface m_mWallpaperTargets.erase(path); // will free the cairo surface