Skip to content

Commit a796130

Browse files
authored
Merge pull request #863 from pbor/gio-example-fix
examples: spawn async gio task on the current thread context
2 parents 380a077 + 9f9def1 commit a796130

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)