From 6983b1906caf31e89d9c92cd04d3b6dc69218bff Mon Sep 17 00:00:00 2001 From: Visal Vijay <150381094+B2krobbery@users.noreply.github.com> Date: Sun, 5 Apr 2026 19:18:44 +0530 Subject: data/dnd: guard against expired dndPointerFocus and ensure consistent usage (#13996) --- src/protocols/core/DataDevice.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/protocols') diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp index 22ccae6c..84c31888 100644 --- a/src/protocols/core/DataDevice.cpp +++ b/src/protocols/core/DataDevice.cpp @@ -657,10 +657,11 @@ void CWLDataDeviceProtocol::updateDrag() { if (m_dnd.focusedDevice) m_dnd.focusedDevice->sendLeave(); - if (!g_pSeatManager->m_state.dndPointerFocus) + auto surface = g_pSeatManager->m_state.dndPointerFocus.lock(); + if (!surface) return; - m_dnd.focusedDevice = dataDeviceForClient(g_pSeatManager->m_state.dndPointerFocus->client()); + m_dnd.focusedDevice = dataDeviceForClient(surface->client()); if (!m_dnd.focusedDevice) return; @@ -695,8 +696,7 @@ void CWLDataDeviceProtocol::updateDrag() { m_dnd.focusedDevice->sendDataOffer(offer); if (const auto WL = offer->getWayland(); WL) WL->sendData(); - m_dnd.focusedDevice->sendEnter(wl_display_next_serial(g_pCompositor->m_wlDisplay), g_pSeatManager->m_state.dndPointerFocus.lock(), - g_pSeatManager->m_state.dndPointerFocus->m_current.size / 2.F, offer); + m_dnd.focusedDevice->sendEnter(wl_display_next_serial(g_pCompositor->m_wlDisplay), surface, surface->m_current.size / 2.F, offer); } void CWLDataDeviceProtocol::cleanupDndState(bool resetDevice, bool resetSource, bool simulateInput) { -- cgit v1.2.3