clutter/cogl/stage: Don't leak FB damage region on redraw

offset_scale_and_clamp_region() creates a new region resulting in
view_damage which at this point is the only thing left pointing to what
originally was fb_damage getting overwritten and being leaked.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1089
This commit is contained in:
Sebastian Keller 2020-02-25 23:28:00 +01:00 committed by Jonas Ådahl
parent 38954de11c
commit c4b28b0939

View File

@ -743,8 +743,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
/* Update the fb clip region with the extra damage. */ /* Update the fb clip region with the extra damage. */
cairo_region_union (fb_clip_region, fb_damage); cairo_region_union (fb_clip_region, fb_damage);
view_damage = g_steal_pointer (&fb_damage); view_damage = offset_scale_and_clamp_region (fb_damage,
view_damage = offset_scale_and_clamp_region (view_damage,
0, 0, 0, 0,
1.0f / fb_scale); 1.0f / fb_scale);
cairo_region_translate (view_damage, view_rect.x, view_rect.y); cairo_region_translate (view_damage, view_rect.x, view_rect.y);
@ -755,6 +754,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cairo_region_union (redraw_clip, view_damage); cairo_region_union (redraw_clip, view_damage);
cairo_region_destroy (view_damage); cairo_region_destroy (view_damage);
cairo_region_destroy (fb_damage);
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n", CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
age, age,