aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-04-23 13:49:25 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-04-24 18:18:51 +0000
commit9c0f1a671cb015b650f7ed80e8fcf66d07c9e87a (patch)
tree861148987ff6013d2b8c5a7a3c783687e34c5711
parentchangelog: scrollback mode freezing, with 100% CPU (diff)
selection: assert serial is non-zero before copying data to the clipboard
-rw-r--r--selection.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/selection.c b/selection.c
index da62d354..8a18c6bb 100644
--- a/selection.c
+++ b/selection.c
@@ -1533,6 +1533,8 @@ static const struct zwp_primary_selection_source_v1_listener primary_selection_s
bool
text_to_clipboard(struct seat *seat, struct terminal *term, char *text, uint32_t serial)
{
+ xassert(serial != 0);
+
struct wl_clipboard *clipboard = &seat->clipboard;
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);
/* Needed when sending the selection to other client */
- xassert(serial != 0);
clipboard->serial = serial;
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)
return false;
+ xassert(serial != 0);
+
struct wl_primary *primary = &seat->primary;
/* TODO: somehow share code with the clipboard equivalent */