Skip to content

Commit 9f9def1

Browse files
pborsdroege
authored andcommitted
examples: spawn async gio task on the current thread context
1 parent 380a077 commit 9f9def1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/gio_task/file_size/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub unsafe extern "C" fn my_file_size_get_file_size_async(
3131
closure,
3232
);
3333

34-
glib::MainContext::default().spawn_local(async move {
34+
glib::MainContext::ref_thread_default().spawn_local(async move {
3535
let size = gio::File::for_path("Cargo.toml")
3636
.query_info_future("*", gio::FileQueryInfoFlags::NONE, glib::PRIORITY_DEFAULT)
3737
.await

examples/gio_task/file_size/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl FileSize {
3939
)
4040
};
4141

42-
glib::MainContext::default().spawn_local(async move {
42+
glib::MainContext::ref_thread_default().spawn_local(async move {
4343
let size = gio::File::for_path("Cargo.toml")
4444
.query_info_future("*", gio::FileQueryInfoFlags::NONE, glib::PRIORITY_DEFAULT)
4545
.await

0 commit comments

Comments
 (0)