dont use target ptrs

This commit is contained in:
vaxerski 2022-07-18 12:26:13 +02:00
parent c81c19f67f
commit 7220ab216c
2 changed files with 5 additions and 5 deletions

View file

@ -84,7 +84,7 @@ 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(); it++) {
if (it->get()->pTarget->m_szPath != path) if (it->get()->target != path)
continue; continue;
@ -195,7 +195,7 @@ void CHyprpaper::ensurePoolBuffersPresent() {
continue; continue;
auto it = std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr<SPoolBuffer>& el) { auto it = std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr<SPoolBuffer>& 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()) { 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); 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); 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) { SPoolBuffer* CHyprpaper::getPoolBuffer(SMonitor* pMonitor, CWallpaperTarget* pWallpaperTarget) {
return std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr<SPoolBuffer>& el) { return std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr<SPoolBuffer>& el) {
return el->pTarget == pWallpaperTarget && el->pixelSize == pMonitor->size * pMonitor->scale; return el->target == pWallpaperTarget->m_szPath && el->pixelSize == pMonitor->size * pMonitor->scale;
})->get(); })->get();
} }

View file

@ -12,6 +12,6 @@ struct SPoolBuffer {
size_t size = 0; size_t size = 0;
std::string name = ""; std::string name = "";
CWallpaperTarget* pTarget = nullptr; std::string target = "";
Vector2D pixelSize; Vector2D pixelSize;
}; };