Commit 26ce4869 authored by David Edmundson's avatar David Edmundson

[xwl] Fix crash if same data is requested twice

Summary:
m_dataRequests is a list of transfers for a given selection.
It exists primarily as a ref counting mechanism that matches up
transfers with selections.

If the same data is requested twice we would insert two items into the
list with matching timestamps for the original selection. This then
confuses the callback handling.

BUG: 417936

Test Plan:
kwin_wayland + chromium
drag and drop a URL onto desktopview. kwin used to crash here
Now a context menu now appears and I can add a link

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28630
parent 6dc93890
......@@ -69,13 +69,12 @@ XToWlDrag::XToWlDrag(X11Source *source)
// we use this mechanism, because the finished call is not
// reliable done by Wayland clients
auto it = std::find_if(m_dataRequests.begin(), m_dataRequests.end(), [eventTime](const QPair<xcb_timestamp_t, bool> &req) {
return req.first == eventTime;
return req.first == eventTime && req.second == false;
});
if (it == m_dataRequests.end()) {
// transfer finished for a different drag
return;
}
Q_ASSERT(!(*it).second);
(*it).second = true;
checkForFinished();
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment