pointer-constraints/native: Fix borders array memory leaks

The borders arrays were not (fully) freed when going out of scope.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2337
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2497>
This commit is contained in:
Sebastian Keller 2022-07-06 18:45:07 +02:00 committed by Georges Basile Stavracas Neto
parent d2c4616242
commit fe0a383d6f

View File

@ -455,7 +455,7 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
MetaPointerConstraintImplNative *constraint_impl_native; MetaPointerConstraintImplNative *constraint_impl_native;
cairo_region_t *region; cairo_region_t *region;
float x, y; float x, y;
GArray *borders; g_autoptr (GArray) borders = NULL;
MetaLine2 motion; MetaLine2 motion;
MetaBorder *closest_border; MetaBorder *closest_border;
uint32_t directions; uint32_t directions;
@ -518,7 +518,6 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
*x_inout = motion.b.x; *x_inout = motion.b.x;
*y_inout = motion.b.y; *y_inout = motion.b.y;
g_array_free (borders, FALSE);
} }
static float static float
@ -607,7 +606,7 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
if (!cairo_region_contains_point (region, (int) x, (int) y)) if (!cairo_region_contains_point (region, (int) x, (int) y))
{ {
GArray *borders; g_autoptr (GArray) borders = NULL;
float closest_distance_2 = FLT_MAX; float closest_distance_2 = FLT_MAX;
MetaBorder *closest_border = NULL; MetaBorder *closest_border = NULL;
ClutterSeat *seat; ClutterSeat *seat;