1
0
Fork 0

wayland/drm-lease: Fix reference count cycle

MetaWaylandDrmLeaseDevice and MetaWaylandDrmLeaseConnector hold a
reference to each other.

In both cases, the reference count was increased. Do not increase the
reference count when lease_connector->lease_device is stored to break
the reference count cycle.

Fixes: fb08a597e1 ("wayland/drm-lease: Advertize initial connectors")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
(cherry picked from commit 9c536939a1)
This commit is contained in:
José Expósito 2024-09-09 20:13:24 +02:00 committed by Jonas Ådahl
parent e9dbc4f6e4
commit e16e8c0121

View file

@ -114,7 +114,6 @@ meta_wayland_drm_lease_connector_free (MetaWaylandDrmLeaseConnector *lease_conne
{
g_object_unref (lease_connector->kms_connector);
g_free (lease_connector->description);
meta_wayland_drm_lease_device_release (lease_connector->lease_device);
}
static void
@ -400,7 +399,7 @@ meta_wayland_drm_lease_connector_new (MetaWaylandDrmLeaseDevice *lease_device,
MetaWaylandDrmLeaseConnector *lease_connector;
lease_connector = g_rc_box_new0 (MetaWaylandDrmLeaseConnector);
lease_connector->lease_device = g_rc_box_acquire (lease_device);
lease_connector->lease_device = lease_device;
lease_connector->kms_connector = g_object_ref (kms_connector);
lease_connector->description = get_connector_description (kms_connector);