[evolution/wip/gsettings] Add forgotten cairo_destroy() calls
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/gsettings] Add forgotten cairo_destroy() calls
- Date: Tue, 9 Nov 2010 22:36:27 +0000 (UTC)
commit 3b3b6cb0abf2bab0a145df00184fc96677870ec8
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 2 11:16:48 2010 +0100
Add forgotten cairo_destroy() calls
calendar/gui/e-day-view-main-item.c | 8 ++++++--
calendar/gui/e-day-view-top-item.c | 8 ++++----
libgnomecanvas/gnome-canvas-pixbuf.c | 4 +++-
widgets/table/e-table-header-utils.c | 8 ++++++--
widgets/text/e-text.c | 6 +++++-
5 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 366062f..08793c9 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -251,14 +251,18 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
font_options = get_font_options ();
- if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ if (!is_array_index_in_bounds (day_view->events[day], event_num)) {
+ cairo_destroy (cr);
return;
+ }
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
- if (!is_comp_data_valid (event))
+ if (!is_comp_data_valid (event)) {
+ cairo_destroy (cr);
return;
+ }
/* Fill in the event background. Note that for events in the first
column of the day, we might not want to paint over the vertical bar,
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index fffb614..1703467 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -76,8 +76,6 @@ day_view_top_item_draw_triangle (EDayViewTopItem *top_item,
gint c1, c2;
cairo_t *cr;
- cr = gdk_cairo_create (drawable);
-
day_view = e_day_view_top_item_get_day_view (top_item);
points[0].x = x;
@@ -102,6 +100,8 @@ day_view_top_item_draw_triangle (EDayViewTopItem *top_item,
if (!is_comp_data_valid (event))
return;
+ cr = gdk_cairo_create (drawable);
+
cairo_save (cr);
/* Fill it in. */
if (gdk_color_parse (
@@ -181,8 +181,6 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
day_view = e_day_view_top_item_get_day_view (top_item);
model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
- cr = gdk_cairo_create (drawable);
-
gradient = calendar_config_get_display_events_gradient ();
alpha = calendar_config_get_display_events_alpha ();
@@ -207,6 +205,8 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
if (!is_comp_data_valid (event))
return;
+ cr = gdk_cairo_create (drawable);
+
style = gtk_widget_get_style (GTK_WIDGET (day_view));
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (
diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c
index 32e83bb..910b61b 100644
--- a/libgnomecanvas/gnome-canvas-pixbuf.c
+++ b/libgnomecanvas/gnome-canvas-pixbuf.c
@@ -280,8 +280,10 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
cr = gdk_cairo_create (drawable);
gnome_canvas_item_i2c_matrix (item, &matrix);
- if (cairo_matrix_invert (&matrix))
+ if (cairo_matrix_invert (&matrix)) {
+ cairo_destroy (cr);
return;
+ }
cairo_transform (cr, &matrix);
gdk_cairo_set_source_pixbuf (cr, priv->pixbuf, 0, 0);
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index 16e0a19..19a493b 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -290,8 +290,10 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
inner_width = button_width - 2 * (xthick + HEADER_PADDING);
inner_height = button_height - 2 * (ythick + HEADER_PADDING);
- if (inner_width < 1 || inner_height < 1)
+ if (inner_width < 1 || inner_height < 1) {
+ cairo_destroy (cr);
return; /* nothing fits */
+ }
inner_x = x + xthick + HEADER_PADDING;
inner_y = y + ythick + HEADER_PADDING;
@@ -314,8 +316,10 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
g_return_if_reached ();
}
- if (inner_width < 1)
+ if (inner_width < 1) {
+ cairo_destroy (cr);
return; /* nothing else fits */
+ }
layout = build_header_layout (widget, ecol->text);
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 74c9385..cbae6d1 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -1443,8 +1443,10 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
if (!text->preedit_len)
reset_layout (text);
- if (!pango_layout_get_text (text->layout))
+ if (!pango_layout_get_text (text->layout)) {
+ cairo_destroy (cr);
return;
+ }
xpos = text->text_cx;
ypos = text->text_cy;
@@ -1514,6 +1516,8 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
}
}
}
+
+ cairo_destroy (cr);
}
/* Point handler for the text item */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]