mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
gio: handle GSimpleAsyncResult errors in _finish vmethods
Originally, the standard idiom with GSimpleAsyncResult was to handle all errors in the _finish wrapper function, so that vmethods only had to deal with successful results. But this means that chaining up to a parent _finish vmethod won't work correctly. Fix this by also checking for errors in all the relevant vmethods. (We have to redundantly check in both the vmethod and the wrapper to preserve compatibility.) https://bugzilla.gnome.org/show_bug.cgi?id=667375 https://bugzilla.gnome.org/show_bug.cgi?id=661767
This commit is contained in:
@@ -294,18 +294,15 @@ g_async_initable_real_init_finish (GAsyncInitable *initable,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
/* Although g_async_initable_init_finish() does this error handling
|
||||
* as well, we do it here too, so that a class that reimplements
|
||||
* GAsyncInitable can properly run its parent class's implementation
|
||||
* by directly invoking its ->init_async() and ->init_finish().
|
||||
*/
|
||||
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;
|
||||
}
|
||||
GSimpleAsyncResult *simple;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user