compositor: Make surface actors unreactive after losing their surface
These actors are expected to be destroyed along with their surface, this however happens later in the process, so there is a moment where actors are eligible for picking, but do not have a surface anymore. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3729>
This commit is contained in:
@ -260,6 +260,18 @@ out:
|
|||||||
parent_class->apply_transform (actor, matrix);
|
parent_class->apply_transform (actor, matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_surface_disposed (gpointer user_data,
|
||||||
|
GObject *destroyed_object)
|
||||||
|
{
|
||||||
|
MetaSurfaceActorWayland *self = user_data;
|
||||||
|
|
||||||
|
g_assert (destroyed_object == (GObject *) self->surface);
|
||||||
|
|
||||||
|
clutter_actor_set_reactive (CLUTTER_ACTOR (self), FALSE);
|
||||||
|
self->surface = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_surface_actor_wayland_dispose (GObject *object)
|
meta_surface_actor_wayland_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -272,8 +284,9 @@ meta_surface_actor_wayland_dispose (GObject *object)
|
|||||||
|
|
||||||
if (self->surface)
|
if (self->surface)
|
||||||
{
|
{
|
||||||
g_object_remove_weak_pointer (G_OBJECT (self->surface),
|
g_object_weak_unref (G_OBJECT (self->surface),
|
||||||
(gpointer *) &self->surface);
|
on_surface_disposed,
|
||||||
|
self);
|
||||||
self->surface = NULL;
|
self->surface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,8 +321,9 @@ meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
|
|||||||
g_assert (meta_is_wayland_compositor ());
|
g_assert (meta_is_wayland_compositor ());
|
||||||
|
|
||||||
self->surface = surface;
|
self->surface = surface;
|
||||||
g_object_add_weak_pointer (G_OBJECT (self->surface),
|
g_object_weak_ref (G_OBJECT (self->surface),
|
||||||
(gpointer *) &self->surface);
|
on_surface_disposed,
|
||||||
|
self);
|
||||||
|
|
||||||
return META_SURFACE_ACTOR (self);
|
return META_SURFACE_ACTOR (self);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user