MetaSurfaceActorWayland: Unset the MetaWaylandSurface pointer when it goes away
We may access it during painting even if it has been freed. For now, manually unset it during the MetaWaylandSurface cleanup; in the future make MetaWaylandSurface a GObject and make the surface pointer a weak reference. https://bugzilla.gnome.org/show_bug.cgi?id=744453
This commit is contained in:
parent
dc99af40f3
commit
ba7c524a18
@ -110,6 +110,9 @@ meta_surface_actor_wayland_get_scale (MetaSurfaceActorWayland *actor)
|
|||||||
MetaWindow *window = surface->window;
|
MetaWindow *window = surface->window;
|
||||||
int output_scale = 1;
|
int output_scale = 1;
|
||||||
|
|
||||||
|
if (!priv->surface)
|
||||||
|
return 1;
|
||||||
|
|
||||||
while (surface)
|
while (surface)
|
||||||
{
|
{
|
||||||
if (surface->window)
|
if (surface->window)
|
||||||
@ -301,3 +304,12 @@ meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
|
|||||||
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
||||||
return priv->surface;
|
return priv->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_surface_actor_wayland_surface_destroyed (MetaSurfaceActorWayland *self)
|
||||||
|
{
|
||||||
|
MetaSurfaceActorWaylandPrivate *priv =
|
||||||
|
meta_surface_actor_wayland_get_instance_private (self);
|
||||||
|
|
||||||
|
priv->surface = NULL;
|
||||||
|
}
|
||||||
|
@ -57,6 +57,7 @@ GType meta_surface_actor_wayland_get_type (void);
|
|||||||
|
|
||||||
MetaSurfaceActor * meta_surface_actor_wayland_new (MetaWaylandSurface *surface);
|
MetaSurfaceActor * meta_surface_actor_wayland_new (MetaWaylandSurface *surface);
|
||||||
MetaWaylandSurface * meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self);
|
MetaWaylandSurface * meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self);
|
||||||
|
void meta_surface_actor_wayland_surface_destroyed (MetaSurfaceActorWayland *self);
|
||||||
|
|
||||||
void meta_surface_actor_wayland_set_texture (MetaSurfaceActorWayland *self,
|
void meta_surface_actor_wayland_set_texture (MetaSurfaceActorWayland *self,
|
||||||
CoglTexture *texture);
|
CoglTexture *texture);
|
||||||
|
@ -616,8 +616,10 @@ meta_window_actor_get_shape_bounds (MetaWindowActor *self,
|
|||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
if (META_IS_SURFACE_ACTOR_WAYLAND (priv->surface))
|
if (META_IS_SURFACE_ACTOR_WAYLAND (priv->surface))
|
||||||
{
|
{
|
||||||
double scale = priv->surface ?
|
MetaSurfaceActorWayland *surface_actor =
|
||||||
meta_surface_actor_wayland_get_scale (META_SURFACE_ACTOR_WAYLAND (priv->surface)) : 1.;
|
META_SURFACE_ACTOR_WAYLAND (priv->surface);
|
||||||
|
double scale = meta_surface_actor_wayland_get_scale (surface_actor);
|
||||||
|
|
||||||
bounds->x *= scale;
|
bounds->x *= scale;
|
||||||
bounds->y *= scale;
|
bounds->y *= scale;
|
||||||
bounds->width *= scale;
|
bounds->width *= scale;
|
||||||
|
@ -802,6 +802,9 @@ wl_surface_destructor (struct wl_resource *resource)
|
|||||||
if (surface->input_region)
|
if (surface->input_region)
|
||||||
cairo_region_destroy (surface->input_region);
|
cairo_region_destroy (surface->input_region);
|
||||||
|
|
||||||
|
meta_surface_actor_wayland_surface_destroyed (
|
||||||
|
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor));
|
||||||
|
|
||||||
g_object_unref (surface->surface_actor);
|
g_object_unref (surface->surface_actor);
|
||||||
|
|
||||||
meta_wayland_compositor_destroy_frame_callbacks (compositor, surface);
|
meta_wayland_compositor_destroy_frame_callbacks (compositor, surface);
|
||||||
|
Loading…
Reference in New Issue
Block a user