[gtksourceview/gtksourceview-5-4] completion: protect against spinning while doing updates



commit a2ea6ac5b2473e3b7892bd744fcd61ee2a86605e
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jun 11 20:35:27 2022 -0700

    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.

 gtksourceview/gtksourcecompletionlistbox.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]