From 7220ab216caace91a907bd9836601a325538e2e6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 18 Jul 2022 12:26:13 +0200 Subject: [PATCH] dont use target ptrs --- src/Hyprpaper.cpp | 8 ++++---- src/helpers/PoolBuffer.hpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index 7d86548..00f65ec 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -84,7 +84,7 @@ void CHyprpaper::unloadWallpaper(const std::string& path) { // clean buffers for (auto it = m_vBuffers.begin(); it != m_vBuffers.end(); it++) { - if (it->get()->pTarget->m_szPath != path) + if (it->get()->target != path) continue; @@ -195,7 +195,7 @@ void CHyprpaper::ensurePoolBuffersPresent() { continue; auto it = std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr& el) { - return el->pTarget == &wt && el->pixelSize == m->size * m->scale; + return el->target == wt.m_szPath && el->pixelSize == m->size * m->scale; }); if (it == m_vBuffers.end()) { @@ -204,7 +204,7 @@ void CHyprpaper::ensurePoolBuffersPresent() { createBuffer(PBUFFER, m->size.x * m->scale, m->size.y * m->scale, WL_SHM_FORMAT_ARGB8888); - PBUFFER->pTarget = &wt; + PBUFFER->target = wt.m_szPath; Debug::log(LOG, "Buffer created, Shared Memory usage: %.1fMB", PBUFFER->size / 1000000.f); @@ -374,7 +374,7 @@ void CHyprpaper::destroyBuffer(SPoolBuffer* pBuffer) { SPoolBuffer* CHyprpaper::getPoolBuffer(SMonitor* pMonitor, CWallpaperTarget* pWallpaperTarget) { return std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr& el) { - return el->pTarget == pWallpaperTarget && el->pixelSize == pMonitor->size * pMonitor->scale; + return el->target == pWallpaperTarget->m_szPath && el->pixelSize == pMonitor->size * pMonitor->scale; })->get(); } diff --git a/src/helpers/PoolBuffer.hpp b/src/helpers/PoolBuffer.hpp index e6db3c5..beba476 100644 --- a/src/helpers/PoolBuffer.hpp +++ b/src/helpers/PoolBuffer.hpp @@ -12,6 +12,6 @@ struct SPoolBuffer { size_t size = 0; std::string name = ""; - CWallpaperTarget* pTarget = nullptr; + std::string target = ""; Vector2D pixelSize; }; \ No newline at end of file