[gnome-calendar] event-widget: fix memory corruption
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event-widget: fix memory corruption
- Date: Thu, 4 Dec 2014 22:37:48 +0000 (UTC)
commit c2eda0e4466403733fad54cbaec41a906374a2d6
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sun Oct 19 20:00:56 2014 -0400
event-widget: fix memory corruption
GdkRBA should not be allocated using g_new0. Used G_SLICE=debug-blocks
to find it.
src/gcal-event-widget.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index 08564c9..c0807b2 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -209,6 +209,7 @@ gcal_event_widget_init(GcalEventWidget *self)
priv = gcal_event_widget_get_instance_private (self);
priv->button_pressed = FALSE;
+ priv->color = NULL;
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
@@ -673,7 +674,7 @@ gcal_event_widget_new_from_data (GcalEventData *data)
ECalComponentId *id;
ECalComponentText e_summary;
ESourceSelectable *extension;
- GdkRGBA *color;
+ GdkRGBA color;
ECalComponentDateTime dt;
icaltimetype *date;
gboolean start_is_date, end_is_date;
@@ -707,14 +708,11 @@ gcal_event_widget_new_from_data (GcalEventData *data)
gcal_event_widget_set_summary (event, (gchar*) e_summary.value);
/* color */
- color = g_new0 (GdkRGBA, 1);
-
extension = E_SOURCE_SELECTABLE (
e_source_get_extension (priv->source,
E_SOURCE_EXTENSION_CALENDAR));
- gdk_rgba_parse (color, e_source_selectable_get_color (extension));
- gcal_event_widget_set_color (event, color);
- gdk_rgba_free (color);
+ gdk_rgba_parse (&color, e_source_selectable_get_color (extension));
+ gcal_event_widget_set_color (event, &color);
/* start date */
e_cal_component_get_dtstart (priv->component, &dt);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]