1
0
Fork 0

window-actor/x11: Fix region leak when updating frame bounds

The value returned by meta_frame_get_frame_bounds() is owned by the
caller so we can assign it directly without copying to avoid a leak and
a bit of unnecessary work. Also it can't ever return NULL, so there is
no need to check for that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3994>
This commit is contained in:
Sebastian Keller 2024-09-01 11:29:12 +02:00
parent cddd3a7df0
commit d1a1b7bfdd

View file

@ -1086,7 +1086,6 @@ update_opaque_region (MetaWindowActorX11 *actor_x11)
static void static void
update_frame_bounds (MetaWindowActorX11 *actor_x11) update_frame_bounds (MetaWindowActorX11 *actor_x11)
{ {
MtkRegion *frame_bounds = NULL;
MetaWindow *window = MetaWindow *window =
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11)); meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
MetaFrame *frame = meta_window_x11_get_frame (window); MetaFrame *frame = meta_window_x11_get_frame (window);
@ -1094,10 +1093,7 @@ update_frame_bounds (MetaWindowActorX11 *actor_x11)
g_clear_pointer (&actor_x11->frame_bounds, mtk_region_unref); g_clear_pointer (&actor_x11->frame_bounds, mtk_region_unref);
if (frame) if (frame)
frame_bounds = meta_frame_get_frame_bounds (frame); actor_x11->frame_bounds = meta_frame_get_frame_bounds (frame);
if (frame_bounds)
actor_x11->frame_bounds = mtk_region_copy (frame_bounds);
} }
static void static void