[gvfs/gnome-3-26] recent: Prevent crash when recent file changed



commit 8b8914855b85ee1e5c702b42cbef18ffa9e6ab93
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Dec 14 10:07:01 2017 +0100

    recent: Prevent crash when recent file changed
    
    If recent file is changed and directory monitor doesn't exists,
    the recent backend crashes. Check the monitor first before emitting
    event in order to prevent this crashes.

 daemon/gvfsbackendrecent.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendrecent.c b/daemon/gvfsbackendrecent.c
index 2947600..a1803f3 100644
--- a/daemon/gvfsbackendrecent.c
+++ b/daemon/gvfsbackendrecent.c
@@ -561,9 +561,10 @@ reload_recent_items (GVfsBackendRecent *backend)
   g_list_free (added);
 
   /* process changes */
-  for (l = changed; l; l = l->next)
+  if (monitor)
     {
-      g_vfs_monitor_emit_event (monitor, G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED, l->data, NULL);
+      for (l = changed; l; l = l->next)
+        g_vfs_monitor_emit_event (monitor, G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED, l->data, NULL);
     }
   g_list_free (changed);
 


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