From 10e1b6fd9db57ef95ecb710335acae1c4bc0d0b2 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 28 Oct 2020 18:47:45 +0100 Subject: [PATCH] xwl: No need to delete the source immediately Prefer replacing then deleting the selection to the other way around. This way less events need to be reported and the clipboard manager doesn't get confused. (cherry picked from commit 4150c1f047b8ff186d1ff8229a2d79dfe03202e2) --- xwl/selection.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xwl/selection.cpp b/xwl/selection.cpp index 3c83bb8cdc..9e4da328d8 100644 --- a/xwl/selection.cpp +++ b/xwl/selection.cpp @@ -167,9 +167,11 @@ void Selection::registerXfixes() void Selection::setWlSource(WlSource *source) { - delete m_waylandSource; + if (m_waylandSource) { + m_waylandSource->deleteLater(); + m_waylandSource = nullptr; + } delete m_xSource; - m_waylandSource = nullptr; m_xSource = nullptr; if (source) { m_waylandSource = source; @@ -179,10 +181,7 @@ void Selection::setWlSource(WlSource *source) void Selection::createX11Source(xcb_xfixes_selection_notify_event_t *event) { - delete m_waylandSource; - delete m_xSource; - m_waylandSource = nullptr; - m_xSource = nullptr; + setWlSource(nullptr); if (!event || event->owner == XCB_WINDOW_NONE) { return; }