mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
wayland: Use weak ref to keep track of buffers
Instead of using a one-shot signal meant to happen then the buffer is being destroyed. https://bugzilla.gnome.org/show_bug.cgi?id=782344
This commit is contained in:
parent
a7ee7559e4
commit
8d75ea69e3
@ -470,14 +470,6 @@ queue_surface_actor_frame_callbacks (MetaWaylandSurface *surface,
|
|||||||
wl_list_init (&pending->frame_callback_list);
|
wl_list_init (&pending->frame_callback_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
pending_buffer_resource_destroyed (MetaWaylandBuffer *buffer,
|
|
||||||
MetaWaylandPendingState *pending)
|
|
||||||
{
|
|
||||||
g_signal_handler_disconnect (buffer, pending->buffer_destroy_handler_id);
|
|
||||||
pending->buffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pending_state_init (MetaWaylandPendingState *state)
|
pending_state_init (MetaWaylandPendingState *state)
|
||||||
{
|
{
|
||||||
@ -510,8 +502,9 @@ pending_state_destroy (MetaWaylandPendingState *state)
|
|||||||
g_clear_pointer (&state->opaque_region, cairo_region_destroy);
|
g_clear_pointer (&state->opaque_region, cairo_region_destroy);
|
||||||
|
|
||||||
if (state->buffer)
|
if (state->buffer)
|
||||||
g_signal_handler_disconnect (state->buffer,
|
g_object_remove_weak_pointer (G_OBJECT (state->buffer),
|
||||||
state->buffer_destroy_handler_id);
|
(gpointer *) &state->buffer);
|
||||||
|
|
||||||
wl_list_for_each_safe (cb, next, &state->frame_callback_list, link)
|
wl_list_for_each_safe (cb, next, &state->frame_callback_list, link)
|
||||||
wl_resource_destroy (cb->resource);
|
wl_resource_destroy (cb->resource);
|
||||||
}
|
}
|
||||||
@ -528,7 +521,10 @@ move_pending_state (MetaWaylandPendingState *from,
|
|||||||
MetaWaylandPendingState *to)
|
MetaWaylandPendingState *to)
|
||||||
{
|
{
|
||||||
if (from->buffer)
|
if (from->buffer)
|
||||||
g_signal_handler_disconnect (from->buffer, from->buffer_destroy_handler_id);
|
{
|
||||||
|
g_object_remove_weak_pointer (G_OBJECT (from->buffer),
|
||||||
|
(gpointer *) &from->buffer);
|
||||||
|
}
|
||||||
|
|
||||||
to->newly_attached = from->newly_attached;
|
to->newly_attached = from->newly_attached;
|
||||||
to->buffer = from->buffer;
|
to->buffer = from->buffer;
|
||||||
@ -554,10 +550,8 @@ move_pending_state (MetaWaylandPendingState *from,
|
|||||||
|
|
||||||
if (to->buffer)
|
if (to->buffer)
|
||||||
{
|
{
|
||||||
to->buffer_destroy_handler_id =
|
g_object_add_weak_pointer (G_OBJECT (to->buffer),
|
||||||
g_signal_connect (to->buffer, "resource-destroyed",
|
(gpointer *) &to->buffer);
|
||||||
G_CALLBACK (pending_buffer_resource_destroyed),
|
|
||||||
to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pending_state_init (from);
|
pending_state_init (from);
|
||||||
@ -913,8 +907,8 @@ wl_surface_attach (struct wl_client *client,
|
|||||||
|
|
||||||
if (surface->pending->buffer)
|
if (surface->pending->buffer)
|
||||||
{
|
{
|
||||||
g_signal_handler_disconnect (surface->pending->buffer,
|
g_object_remove_weak_pointer (G_OBJECT (surface->pending->buffer),
|
||||||
surface->pending->buffer_destroy_handler_id);
|
(gpointer *) &surface->pending->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->pending->newly_attached = TRUE;
|
surface->pending->newly_attached = TRUE;
|
||||||
@ -924,10 +918,8 @@ wl_surface_attach (struct wl_client *client,
|
|||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
surface->pending->buffer_destroy_handler_id =
|
g_object_add_weak_pointer (G_OBJECT (surface->pending->buffer),
|
||||||
g_signal_connect (buffer, "resource-destroyed",
|
(gpointer *) &surface->pending->buffer);
|
||||||
G_CALLBACK (pending_buffer_resource_destroyed),
|
|
||||||
surface->pending);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,6 @@ struct _MetaWaylandPendingState
|
|||||||
/* wl_surface.attach */
|
/* wl_surface.attach */
|
||||||
gboolean newly_attached;
|
gboolean newly_attached;
|
||||||
MetaWaylandBuffer *buffer;
|
MetaWaylandBuffer *buffer;
|
||||||
gulong buffer_destroy_handler_id;
|
|
||||||
int32_t dx;
|
int32_t dx;
|
||||||
int32_t dy;
|
int32_t dy;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user