1
0
Fork 0

compositor: Fix warning with -Wmaybe-uninitialized

Assert that the region is created, thus we passed a valid enum value
to the get_scaled_region() function. Fixes:

  ../../../../Source/gnome/mutter/src/compositor/meta-surface-actor.c: In function ‘get_scaled_region’:
  ../../../../Source/gnome/mutter/src/compositor/meta-surface-actor.c:113:10: warning: ‘scaled_region’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    113 |   return scaled_region;
        |          ^~~~~~~~~~~~~

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1624>
This commit is contained in:
Carlos Garnacho 2020-12-04 16:07:09 +01:00 committed by Marge Bot
parent 14ab90eeba
commit 745ccc5b01

View file

@ -83,7 +83,7 @@ get_scaled_region (MetaSurfaceActor *surface_actor,
ScalePerspectiveType scale_perspective)
{
MetaWindowActor *window_actor;
cairo_region_t *scaled_region;
cairo_region_t *scaled_region = NULL;
int geometry_scale;
float x, y;
@ -107,6 +107,7 @@ get_scaled_region (MetaSurfaceActor *surface_actor,
break;
}
g_assert (scaled_region != NULL);
cairo_region_translate (region, -x, -y);
cairo_region_translate (scaled_region, -x, -y);