[gnome-keyring/dbus-api] [pkcs11] Fix some shutdown ordering problems.



commit cbb8aaddd27041ec07eefb3193489d63abdab6e4
Author: Stef Walter <stef memberwebs com>
Date:   Mon Dec 14 03:22:25 2009 +0000

    [pkcs11] Fix some shutdown ordering problems.

 pkcs11/gck/gck-object.c                 |   10 +++++-----
 pkcs11/secret-store/gck-secret-module.c |   13 ++++++++++++-
 2 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/pkcs11/gck/gck-object.c b/pkcs11/gck/gck-object.c
index 0cb20c3..2d28df3 100644
--- a/pkcs11/gck/gck-object.c
+++ b/pkcs11/gck/gck-object.c
@@ -357,11 +357,8 @@ gck_object_dispose (GObject *obj)
 		if (transient->timed_timer)
 			gck_timer_cancel (transient->timed_timer);
 		transient->timed_timer = NULL;
-
-		g_slice_free (GckObjectTransient, transient);
-		self->pv->transient = NULL;
 	}
-    
+
 	G_OBJECT_CLASS (gck_object_parent_class)->dispose (obj);
 }
 
@@ -377,7 +374,10 @@ gck_object_finalize (GObject *obj)
 	g_object_weak_unref (G_OBJECT (self->pv->module), module_went_away, self);
 	self->pv->module = NULL;
 
-	g_assert (self->pv->transient == NULL);
+	if (self->pv->transient) {
+		g_slice_free (GckObjectTransient, self->pv->transient);
+		self->pv->transient = NULL;
+	}
 
 	G_OBJECT_CLASS (gck_object_parent_class)->finalize (obj);
 }
diff --git a/pkcs11/secret-store/gck-secret-module.c b/pkcs11/secret-store/gck-secret-module.c
index 0e20c3c..c1a5a9a 100644
--- a/pkcs11/secret-store/gck-secret-module.c
+++ b/pkcs11/secret-store/gck-secret-module.c
@@ -343,6 +343,16 @@ gck_secret_module_real_remove_object (GckModule *module, GckTransaction *transac
 	GckSecretModule *self = GCK_SECRET_MODULE (module);
 	GckSecretCollection *collection;
 
+	/* Ignore the session keyring credentials */
+	if (self->session_credential != NULL &&
+	    GCK_OBJECT (self->session_credential) == object)
+		return;
+
+	/* Ignore the session keyring collection */
+	if (self->session_collection != NULL &&
+	    GCK_OBJECT (self->session_collection) == object)
+		return;
+
 	/* Removing an item */
 	if (GCK_IS_SECRET_ITEM (object)) {
 		collection = gck_secret_item_get_collection (GCK_SECRET_ITEM (object));
@@ -360,8 +370,9 @@ gck_secret_module_real_remove_object (GckModule *module, GckTransaction *transac
 
 	/* No other token objects */
 	} else {
+		g_warning ("Trying to remove token object of type '%s' from secret "
+		           "module, but that type is not supported.", G_OBJECT_TYPE_NAME (object));
 		gck_transaction_fail (transaction, CKR_FUNCTION_NOT_SUPPORTED);
-		g_return_if_reached ();
 	}
 }
 



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