summaryrefslogtreecommitdiff
path: root/src/protocols/PrimarySelection.cpp
diff options
context:
space:
mode:
authorJasson <Jasson.cordones@hotmail.com>2025-06-19 13:44:38 -0400
committerGitHub <noreply@github.com>2025-06-19 19:44:38 +0200
commitb49d0ca20e4378db1e9abeb661d72f4c8c070db9 (patch)
tree22df2f551b570daf4495ae8fa1fc0e1f5fdd78ce /src/protocols/PrimarySelection.cpp
parent86b5e3bfbc99237bb28a253fbef49b9c1b7bc3a3 (diff)
xwayland: Fix crash when copying from wayland to xwayland (#10786)
Diffstat (limited to 'src/protocols/PrimarySelection.cpp')
-rw-r--r--src/protocols/PrimarySelection.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/protocols/PrimarySelection.cpp b/src/protocols/PrimarySelection.cpp
index 14df7af5..2b01eddd 100644
--- a/src/protocols/PrimarySelection.cpp
+++ b/src/protocols/PrimarySelection.cpp
@@ -298,6 +298,7 @@ void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) {
if (!DESTDEVICE) {
LOGM(LOG, "CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device");
+ g_pSeatManager->m_selection.currentPrimarySelection.reset();
return;
}
@@ -308,9 +309,10 @@ void CPrimarySelectionProtocol::updateSelection() {
if (!g_pSeatManager->m_state.pointerFocusResource)
return;
+ auto selection = g_pSeatManager->m_selection.currentPrimarySelection.lock();
auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.pointerFocusResource->client());
- if (!DESTDEVICE) {
+ if (!selection || !DESTDEVICE) {
LOGM(LOG, "CPrimarySelectionProtocol::updateSelection: cannot send selection to a client without a data_device");
return;
}