mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
GMemoryInputStream: fix skip_async()
a5876e5f
made GMemoryInputStream subclassable, but accidentally broke read_async() and skip_async() in the process. The immediately followinge7983495
fixed read_async() (and added a test for it), but skip_async() accidentally got... skipped. Fix it now and add a test for it. Also, GMemoryInputStream's skip_async() was assuming that skip() could never fail, which is true of its own implementation, but might not be true of a subclass's, so do proper GError handling too.
This commit is contained in:
@@ -379,10 +379,14 @@ g_memory_input_stream_skip_async (GInputStream *stream,
|
||||
{
|
||||
GTask *task;
|
||||
gssize nskipped;
|
||||
GError *error = NULL;
|
||||
|
||||
nskipped = g_input_stream_skip (stream, count, cancellable, NULL);
|
||||
nskipped = G_INPUT_STREAM_GET_CLASS (stream)->skip (stream, count, cancellable, &error);
|
||||
task = g_task_new (stream, cancellable, callback, user_data);
|
||||
g_task_return_int (task, nskipped);
|
||||
if (error)
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_task_return_int (task, nskipped);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user