mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
gio: Add g_async_result_legacy_propagate_error()
Finish deprecating the "handle GSimpleAsyncResult errors in the wrapper function" idiom (and protect against future GSimpleAsyncResult deprecation warnings) by adding a "legacy" GAsyncResult method to do it in those classes/methods where it had been traditionally done. (This applies only to wrapper methods; in cases where an _async vmethod explicitly uses GSimpleAsyncResult, its corresponding _finish vmethod still uses g_simple_async_result_propagate_error.) https://bugzilla.gnome.org/show_bug.cgi?id=667375 https://bugzilla.gnome.org/show_bug.cgi?id=661767
This commit is contained in:
@@ -655,11 +655,12 @@ g_input_stream_read_finish (GInputStream *stream,
|
||||
g_return_val_if_fail (G_IS_INPUT_STREAM (stream), -1);
|
||||
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), -1);
|
||||
|
||||
if (g_async_result_legacy_propagate_error (result, error))
|
||||
return -1;
|
||||
|
||||
if (G_IS_SIMPLE_ASYNC_RESULT (result))
|
||||
{
|
||||
simple = G_SIMPLE_ASYNC_RESULT (result);
|
||||
if (g_simple_async_result_propagate_error (simple, error))
|
||||
return -1;
|
||||
|
||||
/* Special case read of 0 bytes */
|
||||
if (g_simple_async_result_get_source_tag (simple) == g_input_stream_read_async)
|
||||
@@ -894,11 +895,12 @@ g_input_stream_skip_finish (GInputStream *stream,
|
||||
g_return_val_if_fail (G_IS_INPUT_STREAM (stream), -1);
|
||||
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), -1);
|
||||
|
||||
if (g_async_result_legacy_propagate_error (result, error))
|
||||
return -1;
|
||||
|
||||
if (G_IS_SIMPLE_ASYNC_RESULT (result))
|
||||
{
|
||||
simple = G_SIMPLE_ASYNC_RESULT (result);
|
||||
if (g_simple_async_result_propagate_error (simple, error))
|
||||
return -1;
|
||||
|
||||
/* Special case skip of 0 bytes */
|
||||
if (g_simple_async_result_get_source_tag (simple) == g_input_stream_skip_async)
|
||||
@@ -992,11 +994,12 @@ g_input_stream_close_finish (GInputStream *stream,
|
||||
g_return_val_if_fail (G_IS_INPUT_STREAM (stream), FALSE);
|
||||
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
|
||||
|
||||
if (g_async_result_legacy_propagate_error (result, error))
|
||||
return FALSE;
|
||||
|
||||
if (G_IS_SIMPLE_ASYNC_RESULT (result))
|
||||
{
|
||||
simple = G_SIMPLE_ASYNC_RESULT (result);
|
||||
if (g_simple_async_result_propagate_error (simple, error))
|
||||
return FALSE;
|
||||
|
||||
/* Special case already closed */
|
||||
if (g_simple_async_result_get_source_tag (simple) == g_input_stream_close_async)
|
||||
|
Reference in New Issue
Block a user