[glib] GAsyncInitable: partially revert the init_finish changes



commit d90ad1805552aab969f316a1de687efdb71e27fe
Author: Dan Winship <danw gnome org>
Date:   Tue Jul 17 09:12:39 2012 -0400

    GAsyncInitable: partially revert the init_finish changes
    
    g_async_initable_real_init_finish() was previously handling all
    GSimpleAsyncResults, even if they weren't created by
    g_async_initable_real_init_async(), and libnm-glib accidentally relied
    on that behavior. So remove the g_simple_async_result_is_valid()
    check.

 gio/gasyncinitable.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/gio/gasyncinitable.c b/gio/gasyncinitable.c
index e8cf8c9..d5712a5 100644
--- a/gio/gasyncinitable.c
+++ b/gio/gasyncinitable.c
@@ -290,15 +290,16 @@ g_async_initable_real_init_finish (GAsyncInitable  *initable,
 				   GAsyncResult    *res,
 				   GError         **error)
 {
-  GSimpleAsyncResult *simple;
+  /* For backward compatibility we have to process GSimpleAsyncResults
+   * even if they aren't tagged from g_async_initable_real_init_async.
+   */
+  if (G_IS_SIMPLE_ASYNC_RESULT (res))
+    {
+      GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
+      if (g_simple_async_result_propagate_error (simple, error))
+	return FALSE;
+    }
 
-  g_return_val_if_fail (g_simple_async_result_is_valid (res, G_OBJECT (initable),
-							g_async_initable_real_init_async),
-			FALSE);
-
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  if (g_simple_async_result_propagate_error (simple, error))
-    return FALSE;
   return TRUE;
 }
 



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