]> git.0d.be Git - empathy.git/commitdiff
No need to check if create_results exists in dispose
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 17 Aug 2009 15:37:28 +0000 (16:37 +0100)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 17 Aug 2009 15:37:28 +0000 (16:37 +0100)
libempathy/empathy-account-manager.c

index 00c5cb14f03916112e281fdd1b5f27df5f76bf41..12ecff1aae136bee6635dc2f18e1950a608540b7 100644 (file)
@@ -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)
     {