label: Don't leak clip regions

This was introduced in the conversion to gsk.
This commit is contained in:
Matthias Clasen 2017-09-01 15:32:48 -04:00
parent e6bbc10bd5
commit 6bdebd1570

View File

@ -3948,11 +3948,14 @@ gtk_label_snapshot (GtkWidget *widget,
range_clip = gdk_pango_layout_get_clip_region (priv->layout, lx, ly, range, 1); range_clip = gdk_pango_layout_get_clip_region (priv->layout, lx, ly, range, 1);
cairo_region_get_extents (range_clip, &clip_extents); cairo_region_get_extents (range_clip, &clip_extents);
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_extents), "Selected Text"); gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_extents), "Selected Text");
gtk_snapshot_render_background (snapshot, context, x, 0, width, height); gtk_snapshot_render_background (snapshot, context, x, 0, width, height);
gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout); gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout);
gtk_snapshot_pop (snapshot); gtk_snapshot_pop (snapshot);
cairo_region_destroy (range_clip);
gtk_style_context_restore (context); gtk_style_context_restore (context);
} }
else if (info) else if (info)
@ -3995,6 +3998,8 @@ gtk_label_snapshot (GtkWidget *widget,
gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout); gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout);
gtk_snapshot_pop (snapshot); gtk_snapshot_pop (snapshot);
cairo_region_destroy (range_clip);
gtk_style_context_restore (context); gtk_style_context_restore (context);
} }