[glib] GAppInfoMonitor: don't try to use NULL hash table



commit bda60c3e8b92575520495b8f283ee5ba595da074
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Nov 7 13:56:56 2013 -0500

    GAppInfoMonitor: don't try to use NULL hash table
    
    Don't g_hash_table_iter_init() on a NULL table if we see the app info
    monitoring but no monitors have been created yet.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711632

 gio/gappinfo.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gio/gappinfo.c b/gio/gappinfo.c
index 941015c..0789f5d 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -1237,15 +1237,18 @@ g_app_info_monitor_fire (void)
 
   g_mutex_lock (&g_app_info_monitor_lock);
 
-  g_hash_table_iter_init (&iter, g_app_info_monitors);
-  while (g_hash_table_iter_next (&iter, &context, NULL))
+  if (g_app_info_monitors)
     {
-      GSource *idle;
-
-      idle = g_idle_source_new ();
-      g_source_set_callback (idle, g_app_info_monitor_emit, context, NULL);
-      g_source_attach (idle, context);
-      g_source_unref (idle);
+      g_hash_table_iter_init (&iter, g_app_info_monitors);
+      while (g_hash_table_iter_next (&iter, &context, NULL))
+        {
+          GSource *idle;
+
+          idle = g_idle_source_new ();
+          g_source_set_callback (idle, g_app_info_monitor_emit, context, NULL);
+          g_source_attach (idle, context);
+          g_source_unref (idle);
+        }
     }
 
   g_mutex_unlock (&g_app_info_monitor_lock);


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