From f6c8cbc4f5a8f395a75076cbf8f87d8c47d64390 Mon Sep 17 00:00:00 2001 From: UjinT34 Date: Tue, 30 Sep 2025 09:54:54 +0300 Subject: [PATCH] remove unneeded preferred ref Origin: https://github.com/hyprwm/Hyprland/pull/11877 Bug: https://github.com/hyprwm/Hyprland/discussions/11843 --- src/protocols/ColorManagement.cpp | 27 +++++++-------------------- src/protocols/ColorManagement.hpp | 1 - 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/protocols/ColorManagement.cpp b/src/protocols/ColorManagement.cpp index d126fea2785..aee3b9f0e82 100644 --- a/src/protocols/ColorManagement.cpp +++ b/src/protocols/ColorManagement.cpp @@ -355,14 +355,10 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SPsetDestroy([this](CWpColorManagementSurfaceFeedbackV1* r) { LOGM(TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface); - if (m_currentPreferred.valid()) - PROTO::colorManagement->destroyResource(m_currentPreferred.get()); PROTO::colorManagement->destroyResource(this); }); m_resource->setOnDestroy([this](CWpColorManagementSurfaceFeedbackV1* r) { LOGM(TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface); - if (m_currentPreferred.valid()) - PROTO::colorManagement->destroyResource(m_currentPreferred.get()); PROTO::colorManagement->destroyResource(this); }); @@ -374,9 +370,6 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SPdestroyResource(m_currentPreferred.get()); - const auto RESOURCE = PROTO::colorManagement->m_imageDescriptions.emplace_back( makeShared(makeShared(r->client(), r->version(), id), true)); @@ -386,11 +379,10 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SPm_self = RESOURCE; - m_currentPreferred = RESOURCE; + RESOURCE->m_self = RESOURCE; + RESOURCE->m_settings = m_surface->getPreferredImageDescription(); - m_currentPreferred->m_settings = m_surface->getPreferredImageDescription(); - RESOURCE->resource()->sendReady(m_currentPreferred->m_settings.updateId()); + RESOURCE->resource()->sendReady(RESOURCE->m_settings.updateId()); }); m_resource->setGetPreferredParametric([this](CWpColorManagementSurfaceFeedbackV1* r, uint32_t id) { @@ -401,9 +393,6 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SPdestroyResource(m_currentPreferred.get()); - const auto RESOURCE = PROTO::colorManagement->m_imageDescriptions.emplace_back( makeShared(makeShared(r->client(), r->version(), id), true)); @@ -413,13 +402,11 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SPm_self = RESOURCE; - m_currentPreferred = RESOURCE; - - m_currentPreferred->m_settings = m_surface->getPreferredImageDescription(); - m_currentPreferredId = m_currentPreferred->m_settings.updateId(); + RESOURCE->m_self = RESOURCE; + RESOURCE->m_settings = m_surface->getPreferredImageDescription(); + m_currentPreferredId = RESOURCE->m_settings.updateId(); - if (!PROTO::colorManagement->m_debug && m_currentPreferred->m_settings.icc.fd >= 0) { + if (!PROTO::colorManagement->m_debug && RESOURCE->m_settings.icc.fd >= 0) { LOGM(ERR, "FIXME: parse icc profile"); r->error(WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, "ICC profiles are not supported"); return; diff --git a/src/protocols/ColorManagement.hpp b/src/protocols/ColorManagement.hpp index 4a085b16b38..15762530790 100644 --- a/src/protocols/ColorManagement.hpp +++ b/src/protocols/ColorManagement.hpp @@ -91,7 +91,6 @@ class CColorManagementFeedbackSurface { SP m_resource; wl_client* m_client = nullptr; - WP m_currentPreferred; uint32_t m_currentPreferredId = 0; struct {