[nautilus] icon-container: don't malloc() GdkRGBA colors manually
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] icon-container: don't malloc() GdkRGBA colors manually
- Date: Wed, 15 Dec 2010 11:20:25 +0000 (UTC)
commit 4c026bf53253715251abf076badc4c979cc073c3
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Dec 15 12:17:14 2010 +0100
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.
libnautilus-private/nautilus-icon-container.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index efed0eb..d013459 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -2644,7 +2644,7 @@ start_rubberbanding (NautilusIconContainer *container,
AtkObject *accessible;
NautilusIconContainerDetails *details;
NautilusIconRubberbandInfo *band_info;
- GdkRGBA *fill_color_gdk, outline;
+ GdkRGBA *fill_color_gdk, outline, color;
GList *p;
NautilusIcon *icon;
GtkStyleContext *style;
@@ -2670,9 +2670,9 @@ start_rubberbanding (NautilusIconContainer *container,
NULL);
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) {
@@ -8586,13 +8586,13 @@ setup_label_gcs (NautilusIconContainer *container)
NULL);
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]