mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-04 09:40:19 +00:00
gskpango: Fix a potential cairo_t leak
The previous early return did not cairo_destroy() it.
This commit is contained in:
parent
e7a326e230
commit
bce4d669ee
@ -234,7 +234,6 @@ gsk_pango_renderer_draw_shape (PangoRenderer *renderer,
|
|||||||
int y)
|
int y)
|
||||||
{
|
{
|
||||||
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
||||||
cairo_t *cr;
|
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
PangoCairoShapeRendererFunc shape_renderer;
|
PangoCairoShapeRendererFunc shape_renderer;
|
||||||
gpointer shape_renderer_data;
|
gpointer shape_renderer_data;
|
||||||
@ -263,17 +262,21 @@ gsk_pango_renderer_draw_shape (PangoRenderer *renderer,
|
|||||||
|
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds);
|
cairo_t *cr;
|
||||||
|
|
||||||
layout = pango_renderer_get_layout (renderer);
|
layout = pango_renderer_get_layout (renderer);
|
||||||
if (!layout)
|
if (!layout)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds);
|
||||||
shape_renderer = pango_cairo_context_get_shape_renderer (pango_layout_get_context (layout),
|
shape_renderer = pango_cairo_context_get_shape_renderer (pango_layout_get_context (layout),
|
||||||
&shape_renderer_data);
|
&shape_renderer_data);
|
||||||
|
|
||||||
if (!shape_renderer)
|
if (!shape_renderer)
|
||||||
return;
|
{
|
||||||
|
cairo_destroy (cr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
set_color (crenderer, PANGO_RENDER_PART_FOREGROUND, cr);
|
set_color (crenderer, PANGO_RENDER_PART_FOREGROUND, cr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user