mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-12 05:34:01 -04:00
selection: assert serial is non-zero before copying data to the clipboard
This commit is contained in:
parent
312f0dbcfd
commit
9c0f1a671c
1 changed files with 4 additions and 1 deletions
|
|
@ -1533,6 +1533,8 @@ static const struct zwp_primary_selection_source_v1_listener primary_selection_s
|
||||||
bool
|
bool
|
||||||
text_to_clipboard(struct seat *seat, struct terminal *term, char *text, uint32_t serial)
|
text_to_clipboard(struct seat *seat, struct terminal *term, char *text, uint32_t serial)
|
||||||
{
|
{
|
||||||
|
xassert(serial != 0);
|
||||||
|
|
||||||
struct wl_clipboard *clipboard = &seat->clipboard;
|
struct wl_clipboard *clipboard = &seat->clipboard;
|
||||||
|
|
||||||
if (clipboard->data_source != NULL) {
|
if (clipboard->data_source != NULL) {
|
||||||
|
|
@ -1568,7 +1570,6 @@ text_to_clipboard(struct seat *seat, struct terminal *term, char *text, uint32_t
|
||||||
wl_data_device_set_selection(seat->data_device, clipboard->data_source, serial);
|
wl_data_device_set_selection(seat->data_device, clipboard->data_source, serial);
|
||||||
|
|
||||||
/* Needed when sending the selection to other client */
|
/* Needed when sending the selection to other client */
|
||||||
xassert(serial != 0);
|
|
||||||
clipboard->serial = serial;
|
clipboard->serial = serial;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1981,6 +1982,8 @@ text_to_primary(struct seat *seat, struct terminal *term, char *text, uint32_t s
|
||||||
if (term->wl->primary_selection_device_manager == NULL)
|
if (term->wl->primary_selection_device_manager == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
xassert(serial != 0);
|
||||||
|
|
||||||
struct wl_primary *primary = &seat->primary;
|
struct wl_primary *primary = &seat->primary;
|
||||||
|
|
||||||
/* TODO: somehow share code with the clipboard equivalent */
|
/* TODO: somehow share code with the clipboard equivalent */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue