gdk: Fix wrong usage of g_task_propagate_pointer()

The return value is transfer full, not transfer none.
This commit is contained in:
Benjamin Otte 2017-12-10 01:04:32 +01:00
parent 234d34366a
commit 963264a73a
2 changed files with 8 additions and 32 deletions

View File

@ -251,28 +251,16 @@ gdk_wayland_clipboard_read_finish (GdkClipboard *clipboard,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GInputStream *stream;
GTask *task; GTask *task;
g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (clipboard)), NULL); g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (clipboard)), NULL);
task = G_TASK (result); task = G_TASK (result);
g_return_val_if_fail (g_task_get_source_tag (task) == gdk_wayland_clipboard_read_async, NULL); g_return_val_if_fail (g_task_get_source_tag (task) == gdk_wayland_clipboard_read_async, NULL);
stream = g_task_propagate_pointer (task, error); if (out_mime_type)
*out_mime_type = g_task_get_task_data (task);
if (stream) return g_task_propagate_pointer (task, error);
{
if (out_mime_type)
*out_mime_type = g_task_get_task_data (task);
g_object_ref (stream);
}
else
{
if (out_mime_type)
*out_mime_type = NULL;
}
return stream;
} }
static void static void

View File

@ -1062,33 +1062,21 @@ gdk_x11_clipboard_read_finish (GdkClipboard *clipboard,
GAsyncResult *result, GAsyncResult *result,
GError **error) GError **error)
{ {
GInputStream *stream;
GTask *task; GTask *task;
g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (clipboard)), NULL); g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (clipboard)), NULL);
task = G_TASK (result); task = G_TASK (result);
g_return_val_if_fail (g_task_get_source_tag (task) == gdk_x11_clipboard_read_async, NULL); g_return_val_if_fail (g_task_get_source_tag (task) == gdk_x11_clipboard_read_async, NULL);
stream = g_task_propagate_pointer (task, error); if (out_mime_type)
if (stream)
{ {
if (out_mime_type) GSList *targets;
{
GSList *targets;
targets = g_task_get_task_data (task); targets = g_task_get_task_data (task);
*out_mime_type = targets->data; *out_mime_type = targets ? targets->data : NULL;
}
g_object_ref (stream);
}
else
{
if (out_mime_type)
*out_mime_type = NULL;
} }
return stream; return g_task_propagate_pointer (task, error);
} }
static void static void