From 49233af4658dd742fa3cc8e79455311710862d22 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 20 Apr 2011 11:10:54 +0100 Subject: [PATCH] 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 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clutter/glx/clutter-backend-glx.c b/clutter/glx/clutter-backend-glx.c index 3e565ea4a..5c7365a8b 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 *