[nautilus/fixing-leaks] general: Fix some leaks catched by Valgrind



commit 52733cc59cff10db27f0d431ccfd6ad566807ce7
Author: Carlos Soriano <csoriano redhat com>
Date:   Fri Sep 7 12:38:43 2018 +0200

    general: Fix some leaks catched by Valgrind
    
    This is by just opening and closing the app, we will definitely have
    more by regular usage...

 src/nautilus-application.c | 2 +-
 src/nautilus-files-view.c  | 6 ++++--
 src/nautilus-toolbar.c     | 4 ++--
 src/nautilus-window.c      | 2 ++
 4 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 3199caa6c..cceab8705 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -884,7 +884,7 @@ variant_set_mapping (const GValue       *value,
     return g_value_get_variant (value);
 }
 
-static GActionEntry app_entries[] =
+const static GActionEntry app_entries[] =
 {
     { "new-window", action_new_window, NULL, NULL, NULL },
     { "clone-window", action_clone_window, NULL, NULL, NULL },
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index ad326333a..efec3e662 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -7344,7 +7344,8 @@ real_update_actions_state (NautilusFilesView *view)
     gboolean settings_show_delete_permanently;
     gboolean settings_show_create_link;
     GDriveStartStopType start_stop_type;
-    GFile *current_location;
+    g_autoptr (GFile) current_location = NULL;
+    g_autofree gchar *current_uri = NULL;
     gboolean current_directory_in_xdg_folders;
     gboolean show_star;
     gboolean show_unstar;
@@ -7680,7 +7681,8 @@ real_update_actions_state (NautilusFilesView *view)
      * See https://gitlab.gnome.org/GNOME/nautilus/issues/243
      */
     current_location = nautilus_file_get_location (nautilus_files_view_get_directory_as_file (view));
-    current_directory_in_xdg_folders = eel_uri_is_in_xdg_dirs (g_file_get_uri (current_location));
+    current_uri = g_file_get_uri (current_location);
+    current_directory_in_xdg_folders = eel_uri_is_in_xdg_dirs (current_uri);
 
     show_star = (selection != NULL) &&
                 (current_directory_in_xdg_folders || selection_contains_starred);
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index fb0d2d4c0..67bf99be0 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -1250,8 +1250,8 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
 GtkWidget *
 nautilus_toolbar_new ()
 {
-    return g_object_new (NAUTILUS_TYPE_TOOLBAR,
-                         NULL);
+    return g_object_ref_sink (g_object_new (NAUTILUS_TYPE_TOOLBAR,
+                                            NULL));
 }
 
 GtkWidget *
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 0d1234f15..b42b0c20a 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -2351,6 +2351,8 @@ nautilus_window_finalize (GObject *object)
     /* nautilus_window_close() should have run */
     g_assert (window->slots == NULL);
 
+    g_clear_object (&window->toolbar);
+
     G_OBJECT_CLASS (nautilus_window_parent_class)->finalize (object);
 }
 


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