[gtk/issue-2111] Do not crash when icon themes do not have a context



commit 21cd322df9d29f8dda1ad54512b6c0b53f34bf71
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Nov 13 15:04:42 2019 +0000

    Do not crash when icon themes do not have a context
    
    The Context key is not mandatory, so we need to handle its absence.
    
    Fixes: #2111

 gtk/gtkicontheme.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 29635b6003..e00c37650d 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3204,8 +3204,12 @@ theme_list_contexts (IconTheme  *theme,
     {
       dir = l->data;
 
-      context = g_quark_to_string (dir->context);
-      g_hash_table_replace (contexts, (gpointer) context, NULL);
+      /* The "Context" key can be unset */
+      if (dir->context != 0)
+        {
+          context = g_quark_to_string (dir->context);
+          g_hash_table_replace (contexts, (gpointer) context, NULL);
+        }
 
       l = l->next;
     }


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