[gnome-builder] editor: fix some warnings with document transition



commit 91e82c1ca1879dfd5cf35815f10a30e3bc9e0a6e
Author: Christian Hergert <christian hergert me>
Date:   Mon Dec 8 00:07:47 2014 -0800

    editor: fix some warnings with document transition

 src/documents/gb-document-manager.c |    3 ++-
 src/editor/gb-editor-document.c     |    1 +
 src/editor/gb-editor-view.c         |    7 +------
 3 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/documents/gb-document-manager.c b/src/documents/gb-document-manager.c
index 4d7554e..1980b5e 100644
--- a/src/documents/gb-document-manager.c
+++ b/src/documents/gb-document-manager.c
@@ -72,6 +72,7 @@ gb_document_manager_find_with_file (GbDocumentManager *manager,
   guint i;
 
   g_return_val_if_fail (GB_IS_DOCUMENT_MANAGER (manager), NULL);
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
 
   for (i = 0; i < manager->priv->documents->len; i++)
     {
@@ -87,7 +88,7 @@ gb_document_manager_find_with_file (GbDocumentManager *manager,
           sfile = gb_editor_document_get_file (GB_EDITOR_DOCUMENT (document));
           location = gtk_source_file_get_location (sfile);
 
-          if (g_file_equal (location, file))
+          if (location && g_file_equal (location, file))
             return document;
         }
     }
diff --git a/src/editor/gb-editor-document.c b/src/editor/gb-editor-document.c
index c5c00ba..6d513a8 100644
--- a/src/editor/gb-editor-document.c
+++ b/src/editor/gb-editor-document.c
@@ -803,6 +803,7 @@ gb_editor_document_get_property (GObject    *object,
     case PROP_TITLE:
       g_value_set_string (value,
                           gb_editor_document_get_title (GB_DOCUMENT (self)));
+      break;
 
     case PROP_TRIM_TRAILING_WHITESPACE:
       g_value_set_boolean (value,
diff --git a/src/editor/gb-editor-view.c b/src/editor/gb-editor-view.c
index 2a27e12..36ae0fd 100644
--- a/src/editor/gb-editor-view.c
+++ b/src/editor/gb-editor-view.c
@@ -112,14 +112,9 @@ gb_editor_view_set_document (GbEditorView     *view,
 static void
 gb_editor_view_finalize (GObject *object)
 {
-  GbEditorViewPrivate *priv = GB_EDITOR_VIEW (object)->priv;
   GbEditorView *view = (GbEditorView *)object;
 
-  if (priv->document)
-    {
-      gb_editor_view_disconnect (view, priv->document);
-      g_clear_object (&priv->document);
-    }
+  g_clear_object (&view->priv->document);
 
   G_OBJECT_CLASS (gb_editor_view_parent_class)->finalize (object);
 }


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