summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chergert@redhat.com>2022-06-11 20:35:27 -0700
committerChristian Hergert <chergert@redhat.com>2022-06-12 10:15:08 -0700
commita2ea6ac5b2473e3b7892bd744fcd61ee2a86605e (patch)
tree36a897d3a277d43a1d712cf867b2d3f792edb118
parent945f01d6e73a1a10ec9346fd29230b51b220b859 (diff)
downloadgtksourceview-a2ea6ac5b2473e3b7892bd744fcd61ee2a86605e.tar.gz
completion: protect against spinning while doing updates
This turns out to happen more than anticipated, and could cause us to get into a situation where we loose allocations on the source view.
-rw-r--r--gtksourceview/gtksourcecompletionlistbox.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gtksourceview/gtksourcecompletionlistbox.c b/gtksourceview/gtksourcecompletionlistbox.c
index 67531858..9f0b190d 100644
--- a/gtksourceview/gtksourcecompletionlistbox.c
+++ b/gtksourceview/gtksourcecompletionlistbox.c
@@ -903,8 +903,20 @@ gtk_source_completion_list_box_update_cb (GtkWidget *widget,
g_assert (GTK_SOURCE_IS_COMPLETION_LIST_BOX (self));
- gtk_source_completion_list_box_do_update (self, TRUE);
self->queued_update = 0;
+
+ gtk_source_completion_list_box_do_update (self, TRUE);
+
+ /* There is a chance that the update sequence could cause us to need
+ * to queue another update. But we don't actually need it. Just cancel
+ * any additional request immediately.
+ */
+ if (self->queued_update != 0)
+ {
+ gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->queued_update);
+ self->queued_update = 0;
+ }
+
return G_SOURCE_REMOVE;
}