[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
This commit is contained in:
parent
6dc938907f
commit
26ce4869a0
1 changed files with 1 additions and 2 deletions
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue