[gnome-builder] quick-view: be defensive about ownership



commit 3aef886fcdb894eb7b0f9d239e27358afa834713
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jul 21 23:42:27 2017 -0700

    quick-view: be defensive about ownership
    
    Make sure we hold an extra reference. I somehow hit this case
    when it shouldn't be possible. Perhaps some signals were in
    emission and we got called afterwards.

 .../gbp-quick-highlight-view-addin.c               |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/plugins/quick-highlight/gbp-quick-highlight-view-addin.c 
b/plugins/quick-highlight/gbp-quick-highlight-view-addin.c
index c57453e..bf987b5 100644
--- a/plugins/quick-highlight/gbp-quick-highlight-view-addin.c
+++ b/plugins/quick-highlight/gbp-quick-highlight-view-addin.c
@@ -139,7 +139,8 @@ gbp_quick_highlight_view_addin_do_update (gpointer data)
 
   self->queued_update = 0;
 
-  gbp_quick_highlight_view_addin_match (self);
+  if (self->editor_view != NULL)
+    gbp_quick_highlight_view_addin_match (self);
 
   return G_SOURCE_REMOVE;
 }
@@ -150,13 +151,11 @@ gbp_quick_highlight_view_addin_queue_update (GbpQuickHighlightViewAddin *self)
   g_assert (GBP_IS_QUICK_HIGHLIGHT_VIEW_ADDIN (self));
 
   if (self->queued_update == 0)
-    {
-      self->queued_update =
-        gdk_threads_add_idle_full (G_PRIORITY_LOW,
-                                   gbp_quick_highlight_view_addin_do_update,
-                                   self,
-                                   NULL);
-    }
+    self->queued_update =
+      gdk_threads_add_idle_full (G_PRIORITY_LOW,
+                                 gbp_quick_highlight_view_addin_do_update,
+                                 g_object_ref (self),
+                                 g_object_unref);
 }
 
 static void


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