[mutter] Do not try to unref NULL CoglObjects



commit bdc72dd9d747a4dd0bc363e9fbba08e41e4110f4
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Apr 14 16:21:35 2016 +0200

    Do not try to unref NULL CoglObjects
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765058

 src/backends/meta-cursor.c              |    4 +++-
 src/compositor/meta-surface-actor-x11.c |    3 +--
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-cursor.c b/src/backends/meta-cursor.c
index 55f9c0b..68c1739 100644
--- a/src/backends/meta-cursor.c
+++ b/src/backends/meta-cursor.c
@@ -159,7 +159,9 @@ meta_cursor_sprite_load_from_xcursor_image (MetaCursorSprite *self,
                                            NULL);
   meta_cursor_sprite_set_texture (self, texture,
                                   xc_image->xhot, xc_image->yhot);
-  cogl_object_unref (texture);
+
+  if (texture)
+    cogl_object_unref (texture);
 
   meta_cursor_renderer_realize_cursor_from_xcursor (renderer, self, xc_image);
 }
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index dfc4848..37c86e0 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -102,8 +102,7 @@ detach_pixmap (MetaSurfaceActorX11 *self)
   priv->pixmap = None;
   meta_error_trap_pop (display);
 
-  cogl_object_unref (priv->texture);
-  priv->texture = NULL;
+  g_clear_pointer (&priv->texture, cogl_object_unref);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]