[empathy/mc5: 388/483] No need to check if create_results exists in dispose



commit 65e338cadaca67c77e418903d6887ee0f0196827
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Mon Aug 17 16:37:28 2009 +0100

    No need to check if create_results exists in dispose

 libempathy/empathy-account-manager.c |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c
index 00c5cb1..12ecff1 100644
--- a/libempathy/empathy-account-manager.c
+++ b/libempathy/empathy-account-manager.c
@@ -490,32 +490,28 @@ do_dispose (GObject *obj)
 {
   EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (obj);
   EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+  GHashTableIter iter;
+  GSimpleAsyncResult *result;
 
   if (priv->dispose_run)
     return;
 
   priv->dispose_run = TRUE;
 
-  if (priv->create_results != NULL)
+  /* the manager is being destroyed while there are account creation
+   * processes pending; this should not happen, but emit the callbacks
+   * with an error anyway.
+   */
+  g_hash_table_iter_init (&iter, priv->create_results);
+  while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &result))
     {
-      /* the manager is being destroyed while there are account creation
-       * processes pending; this should not happen, but emit the callbacks
-       * with an error anyway.
-       */
-      GHashTableIter iter;
-      GSimpleAsyncResult *result;
-
-      g_hash_table_iter_init (&iter, priv->create_results);
-      while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &result))
-        {
-          g_simple_async_result_set_error (result, G_IO_ERROR,
-              G_IO_ERROR_CANCELLED, "The account manager was disposed while "
-              "creating the account");
-          g_simple_async_result_complete (result);
-          g_object_unref (result);
-        }
+      g_simple_async_result_set_error (result, G_IO_ERROR,
+          G_IO_ERROR_CANCELLED, "The account manager was disposed while "
+          "creating the account");
+      g_simple_async_result_complete (result);
+      g_object_unref (result);
     }
-
+  g_hash_table_remove_all (priv->create_results);
 
   if (priv->dbus != NULL)
     {



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