From 9517c6443c0a0a9c8abf350e388c0be505c03de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 11 Aug 2020 10:15:01 +0200 Subject: [PATCH] selection: finalize: clear ongoing selection Check for ongoing selection, and *clear* it before bailing out due to the selection not having an end-point. This fixes an issue where a selection was kept as ongoing, even though the button had been released. Typically triggered by clicking without moving the mouse; this started a new selection, then (tried to) finalize it, but failed since the selection didn't have an end-point. --- selection.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selection.c b/selection.c index d0ed7bae..43ef2938 100644 --- a/selection.c +++ b/selection.c @@ -567,14 +567,14 @@ selection_extend(struct seat *seat, struct terminal *term, void selection_finalize(struct seat *seat, struct terminal *term, uint32_t serial) { - if (term->selection.start.row < 0 || term->selection.end.row < 0) - return; - if (!term->selection.ongoing) return; term->selection.ongoing = false; + if (term->selection.start.row < 0 || term->selection.end.row < 0) + return; + assert(term->selection.start.row != -1); assert(term->selection.end.row != -1);