From 1fc6413473a0111086bfcfc11d55157cc0eb327a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 8 Jun 2012 11:47:53 -0400 Subject: [PATCH] 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 file 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); -- 2.7.4