[nautilus] directory-async: keep directory alive

commit e2c5c42a202c9d199c525037ca9700cabe546089
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Oct 7 20:26:30 2015 +0200

    directory-async: keep directory alive
    Lately we did some changes on the view/slot/window/app
    interaction with the directory/model ownership. That means
    that now most of the times the directory/model is freed when
    it should.
    In this case, when loading the children of a directory reports
    an error, say the user doesn't have permission to access the
    directory, the view unref the directory in the signal callback,
    and any further interaction with it by the directory itself after
    signaling becomes accessing invalid memory.
    To avoid this, the directory should have a ref on itself for any
    signal that can cause the owners of it to unref.

 libnautilus-private/nautilus-directory-async.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index e4d9f0a..0bb8c78 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -1062,6 +1062,7 @@ directory_load_done (NautilusDirectory *directory,
        GList *node;
        nautilus_profile_start (NULL);
+        g_object_ref (directory);
        directory->details->directory_loaded = TRUE;
        directory->details->directory_loaded_sent_notification = FALSE;
@@ -1089,6 +1090,7 @@ directory_load_done (NautilusDirectory *directory,
        directory_load_cancel (directory);
+        g_object_unref (directory);
        nautilus_profile_end (NULL);

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