[nautilus] bookmark-list: Fix memory leak



commit 179e0bfaddcf29d8a7f8074cc924d5aa45b1a954
Author: Yi-Soo An <yisooan gmail com>
Date:   Sun Mar 17 20:37:46 2019 +0900

    bookmark-list: Fix memory leak
    
    According to the documentation[1], GFileMonitor object must be freed
    when it is not necessary. g_file_monitor_cancel() doesn't free the object.
    
    [1]: https://developer.gnome.org/gio/stable/GFile.html#g-file-monitor-file

 src/nautilus-bookmark-list.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c
index 6a6162a0a..0f8526ba6 100644
--- a/src/nautilus-bookmark-list.c
+++ b/src/nautilus-bookmark-list.c
@@ -167,7 +167,7 @@ do_finalize (GObject *object)
     if (self->monitor != NULL)
     {
         g_file_monitor_cancel (self->monitor);
-        self->monitor = NULL;
+        g_clear_object (&self->monitor);
     }
 
     g_queue_free (self->pending_ops);
@@ -510,7 +510,7 @@ save_file_async (NautilusBookmarkList *self)
     if (self->monitor != NULL)
     {
         g_file_monitor_cancel (self->monitor);
-        self->monitor = NULL;
+        g_clear_object (&self->monitor);
     }
 
     for (l = self->list; l; l = l->next)


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