From 0eef4db59873c97d6e3b606d50d5ebcc517925d9 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 11 Mar 2024 21:04:17 +0000 Subject: [PATCH] lib: fixup free conditions in done --- libhyprcursor/hyprcursor.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libhyprcursor/hyprcursor.cpp b/libhyprcursor/hyprcursor.cpp index a4a3cca..db31279 100644 --- a/libhyprcursor/hyprcursor.cpp +++ b/libhyprcursor/hyprcursor.cpp @@ -395,10 +395,23 @@ bool CHyprcursorManager::loadThemeStyle(const SCursorStyleInfo& info) { void CHyprcursorManager::cursorSurfaceStyleDone(const SCursorStyleInfo& info) { for (auto& shape : impl->theme.shapes) { - if (shape->resizeAlgo == RESIZE_NONE) + if (shape->resizeAlgo == RESIZE_NONE && shape->shapeType != SHAPE_SVG) continue; - std::erase_if(impl->loadedShapes[shape.get()].images, [info](const auto& e) { return !e->artificial && (info.size == 0 || e->side == info.size); }); + std::erase_if(impl->loadedShapes[shape.get()].images, [info, shape](const auto& e) { + const bool isSVG = shape->shapeType == SHAPE_SVG; + const bool isArtificial = e->artificial; + + // clean artificial rasters made for this + if (isArtificial && e->side == info.size) + return true; + + // clean invalid non-svg rasters + if (!isSVG && e->side == 0) + return true; + + return false; + }); } }