[gnome-menus] entry-directories: protect event handling for directories



commit fab6618f7aaaf1adaf9f0ddfcfff6bd5cb234f03
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Dec 14 15:31:54 2013 +0100

    entry-directories: protect event handling for directories
    
    If a new desktop file is created or deleted in a monitored directory,
    the desktop cache is cleared completely, and the CachedDir structure
    is freed, which causes a segfault. Protect it as long as the new
    event is queued and later handled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720460

 libmenu/entry-directories.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/libmenu/entry-directories.c b/libmenu/entry-directories.c
index 52ddfd8..c827f84 100644
--- a/libmenu/entry-directories.c
+++ b/libmenu/entry-directories.c
@@ -528,6 +528,7 @@ handle_cached_dir_changed (MenuMonitor      *monitor,
   basename = g_path_get_basename (path);
 
   dir = cached_dir_lookup (dirname);
+  cached_dir_add_reference (dir);
 
   if (g_str_has_suffix (basename, ".desktop") ||
       g_str_has_suffix (basename, ".directory"))
@@ -588,6 +589,8 @@ handle_cached_dir_changed (MenuMonitor      *monitor,
 
       cached_dir_queue_monitor_event (dir);
     }
+
+  cached_dir_remove_reference (dir);
 }
 
 static void


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