[gedit] GeditDocument: remove dispose_has_run attribute



commit 73b1b2d775101094175c17021d6012d6ac543197
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jun 21 20:00:10 2014 +0200

    GeditDocument: remove dispose_has_run attribute
    
    doc->priv->location != NULL is sufficient.

 gedit/gedit-document.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 88497e7..a5d776d 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -104,7 +104,6 @@ struct _GeditDocumentPrivate
        guint externally_modified : 1;
        guint deleted : 1;
        guint language_set_by_user : 1;
-       guint dispose_has_run : 1;
 
        /* The search is empty if there is no search context, or if the
         * search text is empty. It is used for the sensitivity of some menu
@@ -259,19 +258,19 @@ gedit_document_dispose (GObject *object)
        /* Metadata must be saved here and not in finalize because the language
         * is gone by the time finalize runs.
         */
-       if ((!doc->priv->dispose_has_run) && (doc->priv->location != NULL))
+       if (doc->priv->location != NULL)
        {
                save_metadata (doc);
+
+               g_object_unref (doc->priv->location);
+               doc->priv->location = NULL;
        }
 
        g_clear_object (&doc->priv->loader);
        g_clear_object (&doc->priv->editor_settings);
        g_clear_object (&doc->priv->metadata_info);
-       g_clear_object (&doc->priv->location);
        g_clear_object (&doc->priv->search_context);
 
-       doc->priv->dispose_has_run = TRUE;
-
        G_OBJECT_CLASS (gedit_document_parent_class)->dispose (object);
 }
 
@@ -892,8 +891,6 @@ gedit_document_init (GeditDocument *doc)
 
        priv->empty_search = TRUE;
 
-       priv->dispose_has_run = FALSE;
-
        priv->mtime.tv_sec = 0;
        priv->mtime.tv_usec = 0;
 


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