Remove an assertion that we hit
authorMatthias Clasen <mclasen@redhat.com>
Mon, 23 May 2022 12:28:00 +0000 (08:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 27 May 2022 11:06:23 +0000 (07:06 -0400)
It appears that we mess up accounting for blinking
cursors sometimes, and can hit blink_cb when there
is a nonempty selection.

Instead of asserting, warn and stop blinking.

Related: #4767

gtk/gtktext.c

index e8e1c5156316669b74f4670841cad55a5959d8d6..b8e15aa2d2c0605aeee4905bc0d08f91a0840d01 100644 (file)
@@ -6571,7 +6571,13 @@ blink_cb (GtkWidget     *widget,
       return G_SOURCE_REMOVE;
     }
 
-  g_assert (priv->selection_bound == priv->current_pos);
+  if (priv->selection_bound != priv->current_pos)
+    {
+      g_warning ("GtkText - unexpected blinking selection. Removing");
+
+      gtk_text_check_cursor_blink (self);
+      return G_SOURCE_REMOVE;
+    }
 
   blink_timeout = get_cursor_blink_timeout (self);
   blink_time = get_cursor_time (self);