From f96fe8eb8a497522abd6fd6c0301abff48604e60 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 2 Nov 2011 08:22:47 +0100 Subject: [PATCH] gck: Don't try and discard handle for session that was not opened --- gck/gck-session.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gck/gck-session.c b/gck/gck-session.c index 8b4ca76..a6ce5f1 100644 --- a/gck/gck-session.c +++ b/gck/gck-session.c @@ -228,7 +228,8 @@ gck_session_dispose (GObject *obj) g_return_if_fail (GCK_IS_SESSION (self)); - if (g_atomic_int_compare_and_exchange (&self->pv->discarded, 0, 1)) { + if (self->pv->handle != 0 && + g_atomic_int_compare_and_exchange (&self->pv->discarded, 0, 1)) { /* * Let the world know that we're discarding the session @@ -247,7 +248,8 @@ gck_session_finalize (GObject *obj) { GckSession *self = GCK_SESSION (obj); - g_assert (g_atomic_int_get (&self->pv->discarded) != 0); + g_assert (self->pv->handle == 0 || + g_atomic_int_get (&self->pv->discarded) != 0); g_clear_object (&self->pv->interaction); g_clear_object (&self->pv->slot); -- 2.7.4