From 24b121c7a3df5d4d5d44f19d6e4129ea82fdfc1e Mon Sep 17 00:00:00 2001 From: Visal Vijay <150381094+B2krobbery@users.noreply.github.com> Date: Sun, 12 Apr 2026 22:27:06 +0530 Subject: cleanup: avoid repeated weak_ptr lock() calls in conditions (#14057) --- src/desktop/view/LayerSurface.cpp | 2 +- src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/desktop/view/LayerSurface.cpp b/src/desktop/view/LayerSurface.cpp index a69dd8e9..ec7c61f2 100644 --- a/src/desktop/view/LayerSurface.cpp +++ b/src/desktop/view/LayerSurface.cpp @@ -388,7 +388,7 @@ void CLayerSurface::onCommit() { if (!WASEXCLUSIVE && ISEXCLUSIVE) g_pInputManager->m_exclusiveLSes.push_back(m_self); else if (WASEXCLUSIVE && !ISEXCLUSIVE) - std::erase_if(g_pInputManager->m_exclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == m_self.lock(); }); + std::erase_if(g_pInputManager->m_exclusiveLSes, [this](const auto& other) { return !other || other == m_self; }); // if the surface was focused and interactive but now isn't, refocus if (WASLASTFOCUS && m_layerSurface->m_current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) { diff --git a/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp b/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp index 642f5095..baf767be 100644 --- a/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp +++ b/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp @@ -129,7 +129,8 @@ void CDwindleAlgorithm::addTarget(SP target) { // last fail-safe to avoid duplicate fullscreens if ((!OPENINGON || OPENINGON->pTarget.lock() == target) && getNodes() > 1) { for (auto& node : m_dwindleNodesData) { - if (node->pTarget.lock() && node->pTarget.lock() != target) { + auto locked = node->pTarget.lock(); + if (locked && locked != target) { OPENINGON = node; break; } -- cgit v1.2.3