aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-05-17 18:37:14 +0200
committervaxerski <[email protected]>2022-05-17 18:37:14 +0200
commit473d4591b095299ed14de0cdc6d6fad6ea422a93 (patch)
tree80feac80b1ba0da3350f1680a17349199acd0bcf
parentdf2215cef76773249d5267b018a4ff9c3079bdd7 (diff)
downloadHyprland-473d4591b095299ed14de0cdc6d6fad6ea422a93.tar.gz
Hyprland-473d4591b095299ed14de0cdc6d6fad6ea422a93.zip
fix some memory issues
-rw-r--r--src/Compositor.cpp2
-rw-r--r--src/events/Layers.cpp23
-rw-r--r--src/helpers/BezierCurve.cpp4
3 files changed, 6 insertions, 23 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index bf98d079..ce807333 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -662,8 +662,8 @@ void CCompositor::cleanupFadingOut() {
g_pHyprOpenGL->m_mLayerFramebuffers[ls].release();
g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls);
- m_lSurfacesFadingOut.remove(ls);
delete ls;
+ m_lSurfacesFadingOut.remove(ls);
Debug::log(LOG, "Cleanup: destroyed a layersurface");
diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp
index 86e2ca1a..d5ad2245 100644
--- a/src/events/Layers.cpp
+++ b/src/events/Layers.cpp
@@ -59,28 +59,11 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
if (!layersurface->fadingOut) {
- if (layersurface->layerSurface->mapped) {
- Debug::log(LOG, "LayerSurface wasn't unmapped, making a snapshot now!");
-
- // make a snapshot and start fade
- // layersurfaces aren't required to unmap before destroy
- g_pHyprOpenGL->makeLayerSnapshot(layersurface);
- layersurface->alpha = 0.f;
-
- layersurface->fadingOut = true;
- } else {
- Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
- layersurface->alpha.setValueAndWarp(0.f);
- layersurface->fadingOut = true;
- }
+ Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
+ layersurface->alpha.setValueAndWarp(0.f);
+ layersurface->fadingOut = true;
}
- if (layersurface->layerSurface->mapped)
- layersurface->layerSurface->mapped = false;
-
- if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus)
- g_pCompositor->m_pLastFocus = nullptr;
-
layersurface->hyprListener_commitLayerSurface.removeCallback();
layersurface->hyprListener_destroyLayerSurface.removeCallback();
layersurface->hyprListener_mapLayerSurface.removeCallback();
diff --git a/src/helpers/BezierCurve.cpp b/src/helpers/BezierCurve.cpp
index 54a18732..bdf2c4b1 100644
--- a/src/helpers/BezierCurve.cpp
+++ b/src/helpers/BezierCurve.cpp
@@ -60,8 +60,8 @@ float CBezierCurve::getYForPoint(float x) {
}
// in the name of performance i shall make a hack
- const auto LOWERPOINT = &m_aPointsBaked[(int)((float)BAKEDPOINTS * lowerT)];
- const auto UPPERPOINT = &m_aPointsBaked[(int)((float)BAKEDPOINTS * upperT)];
+ const auto LOWERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * lowerT), 0, 199)];
+ const auto UPPERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * upperT), 0, 199)];
const auto PERCINDELTA = (x - LOWERPOINT->x) / (UPPERPOINT->x - LOWERPOINT->x);