[gtksourceview] Plug a small leak in the style scheme code



commit e5bc293fd757d2d2f335c8d3210d76aac6a2590d
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Sep 5 10:15:51 2015 +0200

    Plug a small leak in the style scheme code
    
    gtk_style_context_get returns a copy

 gtksourceview/gtksourcestylescheme.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 544ed80..7591797 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -670,18 +670,21 @@ get_cursors_css_style (GtkSourceStyleScheme *scheme,
        if (!get_color (secondary_style, TRUE, &secondary_color))
        {
                GtkStyleContext *context;
+               GdkRGBA *rgba;
 
                context = gtk_widget_get_style_context (widget);
 
                gtk_style_context_get (context,
                                       GTK_STATE_FLAG_NORMAL,
-                                      "background-color", &secondary_color,
+                                      "background-color", &rgba,
                                       NULL);
 
                /* shade the secondary cursor */
-               secondary_color.red *= 0.5;
-               secondary_color.green *= 0.5;
-               secondary_color.blue *= 0.5;
+               secondary_color.red = rgba->red * 0.5;
+               secondary_color.green = rgba->green * 0.5;
+               secondary_color.blue = rgba->blue * 0.5;
+
+               gdk_rgba_free (rgba);
        }
 
        primary_color_str = gdk_rgba_to_string (&primary_color);


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