diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-10-31 09:36:11 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-10-31 09:36:11 +0000 |
| commit | 102d4975a1e9cecb7850f668dc44b52857bf66fe (patch) | |
| tree | 9bbb1734a30ac67dda834b6b3c816dc0c6bd96f7 /input.c | |
| parent | Merge branch 'drag-and-drop' (diff) | |
selection: dnd: fix wl_data_offer_destroy() race
At the end of a drag-and-drop operation, we need to call
`wl_data_offer_finish()`.
We *must* ensure the data offer hasn’t been destroyed before
that. This could previously happen if the compositor decided to send a
regular clipboard offer *after* we had started a drop operation,
but *before* it had finished. The dnd offer was then destroyed when
the clipboard offer was received, causing us to crash in
`wl_data_offer_finish()`.
To handle this, let the receive_offer_context take over ownership of
the data_offer pointer, and “manually” destroy it *after* calling
`wl_data_offer_finish()` in `receive_dnd_done()`.
Note: we should not, and can not, do the same thing for regular
clipboard and primary selection offers; such offers can be used
multiple times and should *not* be destroyed after a single copy
operation.
Diffstat (limited to 'input.c')
0 files changed, 0 insertions, 0 deletions
