summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-icon-container.c
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-01-08 00:34:11 +0100
committerWolfgang Ulbrich <[email protected]>2016-01-13 15:05:42 +0100
commit6a19cea2b87a4977a70b1bd6e14edb09a5ebde62 (patch)
tree9979af1193280a64634b2a35788967ba07c0e93c /libcaja-private/caja-icon-container.c
parentc0e9c136368c537209932431774edef5bb6b8982 (diff)
downloadcaja-6a19cea2b87a4977a70b1bd6e14edb09a5ebde62.tar.bz2
caja-6a19cea2b87a4977a70b1bd6e14edb09a5ebde62.tar.xz
GTK3 icon-container: don't malloc() GdkRGBA colors manually
As GdkRGBA might or might not use internally a different allocator, like g_slice. This should fix some memory corruption issues, thanks to Alban Browaeys for tracking down the bug. taken from: https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-0&id=4c026bf
Diffstat (limited to 'libcaja-private/caja-icon-container.c')
-rw-r--r--libcaja-private/caja-icon-container.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 4cf35d30..645e76ba 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -2884,7 +2884,7 @@ start_rubberbanding (CajaIconContainer *container,
CajaIconContainerDetails *details;
CajaIconRubberbandInfo *band_info;
#if GTK_CHECK_VERSION(3,0,0)
- GdkRGBA *fill_color_gdk;
+ GdkRGBA *fill_color_gdk, color;
GList *p;
CajaIcon *icon;
GtkStyleContext *style;
@@ -2921,9 +2921,9 @@ start_rubberbanding (CajaIconContainer *container,
if (!fill_color_gdk)
{
- fill_color_gdk = g_malloc0 (sizeof (GdkRGBA));
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
- fill_color_gdk);
+ &color);
+ fill_color_gdk = gdk_rgba_copy (&color);
}
if (fill_color_gdk->alpha == 1) {
@@ -9493,14 +9493,14 @@ setup_label_gcs (CajaIconContainer *container)
if (!light_info_color)
{
- light_info_color = g_malloc (sizeof (GdkRGBA));
- g_assert (gdk_rgba_parse (light_info_color, DEFAULT_LIGHT_INFO_COLOR));
+ gdk_rgba_parse (&color, DEFAULT_LIGHT_INFO_COLOR);
+ light_info_color = gdk_rgba_copy (&color);
}
if (!dark_info_color)
{
- dark_info_color = g_malloc (sizeof (GdkRGBA));
- g_assert (gdk_rgba_parse (dark_info_color, DEFAULT_DARK_INFO_COLOR));
+ gdk_rgba_parse (&color, DEFAULT_DARK_INFO_COLOR);
+ dark_info_color = gdk_rgba_copy (&color);
}
gtk_style_context_get_color (style, GTK_STATE_FLAG_SELECTED, &color);