• Home
  • Raw
  • Download

Lines Matching full:task

54 @@ -1822,7 +1822,7 @@ send_message_data_deliver_reply_unlocked (GTask           *task,
59 +/* Called from a user thread, lock is not held; @task is (transfer full) */
61 send_message_data_deliver_error (GTask *task,
63 @@ -1849,13 +1849,14 @@ send_message_data_deliver_error (GTask *task,
67 -/* Called from a user thread, lock is not held; @task is (transfer full) */
68 +/* Called from a user thread, lock is not held; @task is (transfer none) */
72 GTask *task = user_data;
74 - send_message_data_deliver_error (task, G_IO_ERROR, G_IO_ERROR_CANCELLED,
75 + g_object_ref (task);
76 + send_message_data_deliver_error (g_steal_pointer (&task), G_IO_ERROR, G_IO_ERROR_CANCELLED,
84 -/* Called from a user thread, lock is not held; @task is (transfer full) */
85 +/* Called from a user thread, lock is not held; @task is (transfer none) */
89 GTask *task = user_data;
91 - send_message_data_deliver_error (task, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
92 + g_object_ref (task);
93 + send_message_data_deliver_error (g_steal_pointer (&task), G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
292 Subject: [PATCH 5/9] gdbusprivate: Ensure data->task is cleared when it
299 the task callback is called, because `data` is also pointed to by the
300 `user_data` for the task, and that’s freed at the end of the callback.
302 So the existing code was correct to take a copy of `data->task` before
305 After calling `g_task_return_*()`, the existing code unreffed the task
306 (which is correct), but then didn’t clear the `data->task` pointer,
307 leaving `data->task` dangling. That could cause a use-after-free or a
310 Avoid that risk by explicitly clearing `data->task` before calling
335 - GTask *task;
336 + GTask *task; /* (owned) and (nullable) before writing starts and after g_task_return_*()…
345 + /* The task must either not have been created, or have been created, returned
347 + g_assert (data->task == NULL);
356 - GTask *task;
360 - /* Note: we can't access data->task after calling g_task_return_* () because the
363 - task = data->task;
366 + * on @data->task will indirectly cause it to be freed, because @data is
376 + GTask *task = g_steal_pointer (&data->task);
377 g_task_return_error (task, error);
378 - g_object_unref (task);
379 + g_clear_object (&task);
387 + GTask *task = g_steal_pointer (&data->task);
388 g_task_return_boolean (task, TRUE);
389 - g_object_unref (task);
390 + g_clear_object (&task);
398 - GTask *task;
403 - /* Note: we can't access data->task after calling g_task_return_* () because the
406 - task = data->task;
410 + * on @data->task will indirectly cause it to be freed, because @data is
420 + GTask *task = g_steal_pointer (&data->task);
421 g_task_return_new_error (task,
425 - g_object_unref (task);
426 + g_clear_object (&task);
434 - g_task_return_error (task, error);
435 - g_object_unref (task);
439 + GTask *task = g_steal_pointer (&data->task);
440 + g_task_return_error (task, error);
441 + g_clear_object (&task);
451 + GTask *task = g_steal_pointer (&data->task);
452 g_task_return_boolean (task, TRUE);
453 - g_object_unref (task);
454 + g_clear_object (&task);
462 + GTask *task = g_steal_pointer (&data->task);
463 g_task_return_new_error (task,
468 - g_object_unref (task);
469 + g_clear_object (&task);
581 g_task_set_source_tag (data->task, write_message_async);
582 g_task_set_name (data->task, "[gio] D-Bus write message");
715 -/* can be called from any thread with lock held; @task is (transfer full) */
716 +/* can be called from any thread with lock held; @task is (transfer none) */
718 send_message_with_reply_cleanup (GTask *task, gboolean remove)
720 @@ -1798,13 +1798,11 @@ send_message_with_reply_cleanup (GTask *task, gboolean remove)
725 - g_object_unref (task);
730 -/* Called from GDBus worker thread with lock held; @task is (transfer full). */
731 +/* Called from GDBus worker thread with lock held; @task is (transfer none). */
733 send_message_data_deliver_reply_unlocked (GTask *task,
735 @@ -1822,7 +1820,7 @@ send_message_data_deliver_reply_unlocked (GTask *task,
739 -/* Called from a user thread, lock is not held; @task is (transfer full) */
740 +/* Called from a user thread, lock is not held; @task is (transfer none) */
742 send_message_data_deliver_error (GTask *task,
744 @@ -1839,7 +1837,10 @@ send_message_data_deliver_error (GTask *task,
748 + /* Hold a ref on @task as send_message_with_reply_cleanup() will remove it
749 + * from the task map and could end up dropping the last reference */
750 g_object_ref (task);
752 send_message_with_reply_cleanup (task, TRUE);
757 GTask *task = user_data;
759 - g_object_ref (task);
760 - send_message_data_deliver_error (g_steal_pointer (&task), G_IO_ERROR, G_IO_ERROR_CANCELLED,
761 + send_message_data_deliver_error (task, G_IO_ERROR, G_IO_ERROR_CANCELLED,
767 GTask *task = user_data;
769 - g_object_ref (task);
770 - send_message_data_deliver_error (g_steal_pointer (&task), G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
771 + send_message_data_deliver_error (task, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
850 @@ -1784,7 +1785,7 @@ send_message_with_reply_cleanup (GTask *task, gboolean remove)
861 send_message_data_deliver_error (task, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
870 g_task_attach_source (task, data->timeout_source,