[gnome-builder] buffer: keep some things around until finalize



commit 5030d2c3ff3e1cec33c94d2db5c107515c29d49d
Author: Christian Hergert <chergert redhat com>
Date:   Wed Sep 6 13:55:40 2017 -0700

    buffer: keep some things around until finalize
    
    Some of these are safe to keep around until finalize, and they can be
    useful to reduce our chances of using something after it has been set
    to NULL.

 libide/buffers/ide-buffer.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libide/buffers/ide-buffer.c b/libide/buffers/ide-buffer.c
index 238dd3d..d22f400 100644
--- a/libide/buffers/ide-buffer.c
+++ b/libide/buffers/ide-buffer.c
@@ -1418,7 +1418,7 @@ ide_buffer_dispose (GObject *object)
       g_clear_object (&priv->file_monitor);
     }
 
-  g_clear_object (&priv->file_signals);
+  dzl_signal_group_set_target (priv->file_signals, NULL);
 
   if (priv->highlight_engine != NULL)
     g_object_run_dispose (G_OBJECT (priv->highlight_engine));
@@ -1433,9 +1433,6 @@ ide_buffer_dispose (GObject *object)
 
   g_clear_pointer (&priv->diagnostics_line_cache, g_hash_table_unref);
   g_clear_pointer (&priv->diagnostics, ide_diagnostics_unref);
-  g_clear_pointer (&priv->content, g_bytes_unref);
-  g_clear_pointer (&priv->title, g_free);
-  g_clear_object (&priv->file);
   g_clear_object (&priv->addins);
   g_clear_object (&priv->highlight_engine);
   g_clear_object (&priv->rename_provider_adapter);
@@ -1454,6 +1451,11 @@ ide_buffer_finalize (GObject *object)
 
   IDE_ENTRY;
 
+  g_clear_object (&priv->file_signals);
+  g_clear_object (&priv->file);
+  g_clear_pointer (&priv->title, g_free);
+  g_clear_pointer (&priv->content, g_bytes_unref);
+
   if (priv->context != NULL)
     {
       g_object_weak_unref (G_OBJECT (priv->context),


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