[clutter] clutter-backend-glx: Protect against unrefing the Cogl context twice



commit 49233af4658dd742fa3cc8e79455311710862d22
Author: Neil Roberts <neil linux intel com>
Date:   Wed Apr 20 11:10:54 2011 +0100

    clutter-backend-glx: Protect against unrefing the Cogl context twice
    
    The dispose function may be called multiple times during destruction
    so it needs to be resilient against destroying any resources
    twice. This wasn't the case for the reference to the Cogl context.

 clutter/glx/clutter-backend-glx.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/clutter/glx/clutter-backend-glx.c b/clutter/glx/clutter-backend-glx.c
index 3e565ea..5c7365a 100644
--- a/clutter/glx/clutter-backend-glx.c
+++ b/clutter/glx/clutter-backend-glx.c
@@ -147,7 +147,11 @@ clutter_backend_glx_dispose (GObject *gobject)
    * make Cogl calls during destruction which would cause a crash */
   G_OBJECT_CLASS (clutter_backend_glx_parent_class)->dispose (gobject);
 
-  cogl_object_unref (backend->cogl_context);
+  if (backend->cogl_context)
+    {
+      cogl_object_unref (backend->cogl_context);
+      backend->cogl_context = NULL;
+    }
 }
 
 static GObject *



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