From 862eebceb6f0a3faa407e953e69eeb9ccc133036 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 9 Jan 2012 19:11:43 +0000 Subject: [PATCH] wayland-surface: Cleanup properly in _dispose When disposing a ClutterWaylandSurface we now make sure to unref any pipeline we created and unref any surface buffer textures we created. Reviewed-by: Neil Roberts Reviewed-by: Emmanuele Bassi --- clutter/wayland/clutter-wayland-surface.c | 30 +++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/clutter/wayland/clutter-wayland-surface.c b/clutter/wayland/clutter-wayland-surface.c index 667f11713..9a163cd4c 100644 --- a/clutter/wayland/clutter-wayland-surface.c +++ b/clutter/wayland/clutter-wayland-surface.c @@ -168,12 +168,29 @@ clutter_wayland_surface_init (ClutterWaylandSurface *self) g_signal_connect (self, "notify::opacity", G_CALLBACK (opacity_change_cb), NULL); } +static void +free_surface_buffers (ClutterWaylandSurface *self) +{ + ClutterWaylandSurfacePrivate *priv = self->priv; + + if (priv->buffer) + { + cogl_object_unref (priv->buffer); + priv->buffer = NULL; + free_pipeline (self); + } +} + static void clutter_wayland_surface_dispose (GObject *object) { ClutterWaylandSurface *self = CLUTTER_WAYLAND_SURFACE (object); ClutterWaylandSurfacePrivate *priv = self->priv; + free_pipeline (self); + free_surface_buffers (self); + priv->surface = NULL; + G_OBJECT_CLASS (clutter_wayland_surface_parent_class)->dispose (object); } @@ -424,19 +441,6 @@ clutter_wayland_surface_new (struct wl_surface *surface) return actor; } -static void -free_surface_buffers (ClutterWaylandSurface *self) -{ - ClutterWaylandSurfacePrivate *priv = self->priv; - - if (priv->buffer) - { - cogl_object_unref (priv->buffer); - priv->buffer = NULL; - free_pipeline (self); - } -} - /** * clutter_wayland_surface_attach_buffer: * @self: A #ClutterWaylandSurface actor