[libdazzle] shortcuts: contexts hashtable expects interned string



commit f9e00e64af77e0cffd886fb64774e08ff26f69e8
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 13 21:54:58 2017 -0800

    shortcuts: contexts hashtable expects interned string
    
    This was both a leak and incorrect because we use the pointer as
    the hash key in the hashtable.

 src/shortcuts/dzl-shortcut-theme.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-theme.c b/src/shortcuts/dzl-shortcut-theme.c
index 0295133..4dc755a 100644
--- a/src/shortcuts/dzl-shortcut-theme.c
+++ b/src/shortcuts/dzl-shortcut-theme.c
@@ -352,7 +352,7 @@ dzl_shortcut_theme_add_context (DzlShortcutTheme   *self,
 
   g_return_if_fail (name != NULL);
 
-  g_hash_table_insert (priv->contexts, g_strdup (name), g_object_ref (context));
+  g_hash_table_insert (priv->contexts, (gchar *)g_intern_string (name), g_object_ref (context));
 }
 
 DzlShortcutTheme *


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