dovecot-2.0: auth: Another attempt in trying to fix crashed at d...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 7 21:28:29 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/fd447208ccb9
changeset: 11492:fd447208ccb9
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 07 19:28:15 2010 +0100
description:
auth: Another attempt in trying to fix crashed at deinit on pending async auth request lookups.

diffstat:

 src/auth/auth-request-handler.c |  23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diffs (53 lines):

diff -r 2f084e625f09 -r fd447208ccb9 src/auth/auth-request-handler.c
--- a/src/auth/auth-request-handler.c	Mon Jun 07 19:17:46 2010 +0100
+++ b/src/auth/auth-request-handler.c	Mon Jun 07 19:28:15 2010 +0100
@@ -62,14 +62,25 @@
 static void auth_request_handler_unref(struct auth_request_handler **_handler)
 {
         struct auth_request_handler *handler = *_handler;
-	struct hash_iterate_context *iter;
-	void *key, *value;
 
 	*_handler = NULL;
 	i_assert(handler->refcount > 0);
 	if (--handler->refcount > 0)
 		return;
 
+	/* notify parent that we're done with all requests */
+	handler->callback(NULL, handler->context);
+
+	hash_table_destroy(&handler->requests);
+	pool_unref(&handler->pool);
+}
+
+static void
+auth_request_handler_destroy_requests(struct auth_request_handler *handler)
+{
+	struct hash_iterate_context *iter;
+	void *key, *value;
+
 	iter = hash_table_iterate_init(handler->requests);
 	while (hash_table_iterate(iter, &key, &value)) {
 		struct auth_request *auth_request = value;
@@ -78,12 +89,7 @@
 		auth_request_unref(&auth_request);
 	}
 	hash_table_iterate_deinit(&iter);
-
-	/* notify parent that we're done with all requests */
-	handler->callback(NULL, handler->context);
-
-	hash_table_destroy(&handler->requests);
-	pool_unref(&handler->pool);
+	hash_table_clear(handler->requests, TRUE);
 }
 
 void auth_request_handler_destroy(struct auth_request_handler **_handler)
@@ -95,6 +101,7 @@
 	i_assert(!handler->destroyed);
 
 	handler->destroyed = TRUE;
+	auth_request_handler_destroy_requests(handler);
 	auth_request_handler_unref(&handler);
 }
 


More information about the dovecot-cvs mailing list