internal: fix crash on scale change

This commit is contained in:
vaxerski 2023-04-09 18:52:43 +01:00
parent e95b8d59f3
commit 9a8a5738c6

View file

@ -392,10 +392,14 @@ 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<SPoolBuffer>& el) {
const auto IT = std::find_if(m_vBuffers.begin(), m_vBuffers.end(), [&](const std::unique_ptr<SPoolBuffer>& el) {
auto scale = std::round((pMonitor->pCurrentLayerSurface && pMonitor->pCurrentLayerSurface->pFractionalScaleInfo ? pMonitor->pCurrentLayerSurface->fScale : pMonitor->scale) * 120.0) / 120.0;
return el->target == pWallpaperTarget->m_szPath && vectorDeltaLessThan(el->pixelSize, pMonitor->size * scale, 1);
})->get();
});
if (IT == m_vBuffers.end())
return nullptr;
return IT->get();
}
void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) {