[gtk+] gtkcssprovider: Use g_slice_dup() to copy GValues around



commit 747dc65c2c8ac1b3ec21e254af2291cfdbb0074e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon May 30 19:04:22 2011 +0200

    gtkcssprovider: Use g_slice_dup() to copy GValues around
    
    GValues stored in GtkCssRulesets are gslice managed, so don't
    g_memdup() GValues from shorthand properties. This fixes
    memory corruptions when reloading contents in a GtkCssProvider.

 gtk/gtkcssprovider.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index d433573..4fe6759 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -1086,9 +1086,9 @@ gtk_css_ruleset_add (GtkCssRuleset          *ruleset,
         {
           const GtkStyleProperty *child;
           GValue *value;
-          
+
           child = _gtk_style_property_lookup (parameters[i].name);
-          value = g_memdup (&parameters[i].value, sizeof (GValue));
+          value = g_slice_dup (GValue, &parameters[i].value);
           gtk_css_ruleset_add (ruleset, child, value);
         }
       g_free (parameters);



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