[evolution-data-server] ldap: Avoid a race during finalize.



commit 1fc6413473a0111086bfcfc11d55157cc0eb327a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jun 8 11:47:53 2012 -0400

    ldap: Avoid a race during finalize.
    
    Remove the poll timeout before unbinding the LDAP to avoid a race.

 addressbook/backends/ldap/e-book-backend-ldap.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index 6085a27..d3d2ab8 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -5470,14 +5470,15 @@ e_book_backend_ldap_finalize (GObject *object)
 	g_static_rec_mutex_unlock (&priv->op_hash_mutex);
 	g_static_rec_mutex_free (&priv->op_hash_mutex);
 
+	/* Remove the timeout before unbinding to avoid a race. */
+	if (priv->poll_timeout > 0)
+		g_source_remove (priv->poll_timeout);
+
 	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (priv->ldap)
 		ldap_unbind (priv->ldap);
 	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-	if (priv->poll_timeout > 0)
-		g_source_remove (priv->poll_timeout);
-
 	g_slist_foreach (priv->supported_fields, (GFunc) g_free, NULL);
 	g_slist_free (priv->supported_fields);
 



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