Skip to content

Commit 3c75dbf

Browse files
committed
task: Use GBinding as the task object in spawn_blocking
It's just a placeholder, but using cancellable is confusing, since it's an actual type that GTask supports.
1 parent 13a529c commit 3c75dbf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gio/src/task.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,10 @@ where
519519
T: Send + 'static,
520520
F: FnOnce() -> T + Send + 'static,
521521
{
522-
// use Cancellable::NONE as source obj to fulfill `Send` requirement
523-
let task = unsafe { Task::<bool>::new(Cancellable::NONE, Cancellable::NONE, |_, _| {}) };
522+
// use a None GBinding as source obj to fulfill `Send` requirement
523+
let task = unsafe { Task::<bool>::new(None::<&glib::Binding>, Cancellable::NONE, |_, _| {}) };
524524
let (join, tx) = JoinHandle::new();
525-
task.run_in_thread(move |task, _: Option<&Cancellable>, _| {
525+
task.run_in_thread(move |task, _: Option<&glib::Binding>, _| {
526526
let res = panic::catch_unwind(panic::AssertUnwindSafe(func));
527527
let _ = tx.send(res);
528528
unsafe { ffi::g_task_return_pointer(task.to_glib_none().0, ptr::null_mut(), None) }

0 commit comments

Comments
 (0)