[xwl] Fix crash if same data is requested twice
ClosedPublic

Authored by davidedmundson on Apr 6 2020, 5:11 PM.

Details

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

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Apr 6 2020, 5:11 PM
Restricted Application added a project: KWin. · View Herald TranscriptApr 6 2020, 5:11 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
davidedmundson requested review of this revision.Apr 6 2020, 5:11 PM
romangg accepted this revision.EditedApr 6 2020, 5:56 PM
romangg added a subscriber: romangg.

Yes, makes sense. I checked back on the protocol to see if a Wayland client can request the same offer multiple times and of course it can to receive multiple mime types.

The assert afterwards becomes useless by that (since you check !req.second already).

This revision is now accepted and ready to land.Apr 6 2020, 5:56 PM
This revision was automatically updated to reflect the committed changes.