diff options
| author | Visal Vijay <150381094+B2krobbery@users.noreply.github.com> | 2026-04-05 19:18:44 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-05 14:48:44 +0100 |
| commit | 6983b1906caf31e89d9c92cd04d3b6dc69218bff (patch) | |
| tree | b00c31a4046b00fd28ea9f98ab62cf5abaaa2c04 /src/protocols/core/DataDevice.cpp | |
| parent | d7edc50eb441b0f90198c431f76030ebb90cc04d (diff) | |
data/dnd: guard against expired dndPointerFocus and ensure consistent usage (#13996)
Diffstat (limited to 'src/protocols/core/DataDevice.cpp')
| -rw-r--r-- | src/protocols/core/DataDevice.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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) { |
