[gnome-calendar] event-widget: fix memory leak.
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event-widget: fix memory leak.
- Date: Thu, 4 Dec 2014 22:37:53 +0000 (UTC)
commit 3805496dbbdaad3d988d8582c244743ab1175f2e
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sun Oct 19 20:08:05 2014 -0400
event-widget: fix memory leak.
According to valgrind pango leaks memory when creating a PangoLayout
using gtk_widget_create_pango_layout with a literal string.
src/gcal-event-widget.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index c0807b2..b612af8 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -393,12 +393,11 @@ gcal_event_widget_get_preferred_height (GtkWidget *widget,
GtkBorder margin;
GtkBorder padding;
PangoLayout *layout;
- PangoRectangle logical_rect;
+ gint height;
- layout = gtk_widget_create_pango_layout (widget, "00:00:00 00:00");
+ layout = gtk_widget_create_pango_layout (widget, NULL);
- pango_layout_get_extents (layout, NULL, &logical_rect);
- pango_extents_to_pixels (&logical_rect, NULL);
+ pango_layout_get_pixel_size (layout, NULL, &height);
gtk_style_context_get_margin (gtk_widget_get_style_context (widget),
gtk_widget_get_state_flags (widget),
@@ -408,7 +407,7 @@ gcal_event_widget_get_preferred_height (GtkWidget *widget,
&padding);
*minimum = *natural =
- logical_rect.height + padding.top + padding.bottom + margin.top + margin.bottom;
+ height + padding.top + padding.bottom + margin.top + margin.bottom;
g_object_unref (layout);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]