[Xfce4-commits] [xfce/thunar] 01/01: Fix object unreferencing (Bug #12260)

noreply at xfce.org noreply at xfce.org
Fri Feb 10 22:55:58 CET 2017


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository xfce/thunar.

commit 240a7f3b34694bb737ebbb9145b11bbc3e65553b
Author: Vladimir Chren <vlado.chren at inmail.sk>
Date:   Thu Feb 9 11:00:58 2017 +0100

    Fix object unreferencing (Bug #12260)
    
    Object unreferencing is now called only after deferred
    function using the object returns.
---
 thunar/thunar-file.c | 22 ++++++++++++++++++++++
 thunar/thunar-file.h |  1 +
 thunar/thunar-job.c  |  3 +--
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index c2a89d8..c7aae58 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -3988,6 +3988,28 @@ thunar_file_reload_idle (ThunarFile *file)
 
 
 /**
+ * thunar_file_reload_idle_unref:
+ * @file : a #ThunarFile instance.
+ *
+ * Schedules a reload of the @file by calling thunar_file_reload
+ * when idle. When scheduled function returns @file object will be
+ * unreferenced.
+ *
+ **/
+void
+thunar_file_reload_idle_unref (ThunarFile *file)
+{
+  _thunar_return_if_fail (THUNAR_IS_FILE (file));
+
+  g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
+                   (GSourceFunc) thunar_file_reload,
+                   file,
+                   (GDestroyNotify) g_object_unref);
+}
+
+
+
+/**
  * thunar_file_destroy:
  * @file : a #ThunarFile instance.
  *
diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h
index cfc3d05..da5b2a4 100644
--- a/thunar/thunar-file.h
+++ b/thunar/thunar-file.h
@@ -241,6 +241,7 @@ void              thunar_file_unwatch                    (ThunarFile
 
 gboolean          thunar_file_reload                     (ThunarFile              *file);
 void              thunar_file_reload_idle                (ThunarFile              *file);
+void              thunar_file_reload_idle_unref          (ThunarFile              *file);
 void              thunar_file_reload_parent              (ThunarFile              *file);
 
 void              thunar_file_destroy                    (ThunarFile              *file);
diff --git a/thunar/thunar-job.c b/thunar/thunar-job.c
index f4ce28e..aa84cb3 100644
--- a/thunar/thunar-job.c
+++ b/thunar/thunar-job.c
@@ -578,8 +578,7 @@ thunar_job_new_files (ThunarJob   *job,
           file = thunar_file_cache_lookup (lp->data);
           if (file != NULL)
             {
-              thunar_file_reload_idle (file);
-              g_object_unref (file);
+              thunar_file_reload_idle_unref (file);
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list