GMemoryInputStream: fix skip_async()

a5876e5f made GMemoryInputStream subclassable, but accidentally broke
read_async() and skip_async() in the process. The immediately
following e7983495 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:
Dan Winship
2013-01-05 13:26:23 -05:00
parent 330c6c116e
commit f42347d82e
2 changed files with 48 additions and 3 deletions

View File

@@ -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);
}