Skip to content

Commit d123363

Browse files
author
Paolo Borelli
committed
gio: remove Send + Sync requirements from DBusConnection::register_object
glib documentation says: "Calls to functions in vtable (and user_data_free_func ) will happen in the thread-default main context of the thread you are calling this method from."
1 parent 261bb09 commit d123363

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

gio/src/dbus_connection.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,17 @@ impl DBusConnection {
3434
) -> Result<RegistrationId, glib::Error>
3535
where
3636
MethodCall: Fn(DBusConnection, &str, &str, &str, &str, glib::Variant, DBusMethodInvocation)
37-
+ Send
38-
+ Sync
39-
+ 'static,
40-
GetProperty:
41-
Fn(DBusConnection, &str, &str, &str, &str) -> glib::Variant + Send + Sync + 'static,
42-
SetProperty: Fn(DBusConnection, &str, &str, &str, &str, glib::Variant) -> bool
43-
+ Send
44-
+ Sync
4537
+ 'static,
38+
GetProperty: Fn(DBusConnection, &str, &str, &str, &str) -> glib::Variant + 'static,
39+
SetProperty: Fn(DBusConnection, &str, &str, &str, &str, glib::Variant) -> bool + 'static,
4640
{
4741
unsafe {
4842
let mut error = std::ptr::null_mut();
4943
let id = ffi::g_dbus_connection_register_object_with_closures(
5044
self.to_glib_none().0,
5145
object_path.to_glib_none().0,
5246
interface_info.to_glib_none().0,
53-
glib::Closure::new(move |args| {
47+
glib::Closure::new_local(move |args| {
5448
let conn = args[0].get::<DBusConnection>().unwrap();
5549
let sender = args[1].get::<&str>().unwrap();
5650
let object_path = args[2].get::<&str>().unwrap();
@@ -71,7 +65,7 @@ impl DBusConnection {
7165
})
7266
.to_glib_none()
7367
.0,
74-
glib::Closure::new(move |args| {
68+
glib::Closure::new_local(move |args| {
7569
let conn = args[0].get::<DBusConnection>().unwrap();
7670
let sender = args[1].get::<&str>().unwrap();
7771
let object_path = args[2].get::<&str>().unwrap();
@@ -83,7 +77,7 @@ impl DBusConnection {
8377
})
8478
.to_glib_none()
8579
.0,
86-
glib::Closure::new(move |args| {
80+
glib::Closure::new_local(move |args| {
8781
let conn = args[0].get::<DBusConnection>().unwrap();
8882
let sender = args[1].get::<&str>().unwrap();
8983
let object_path = args[2].get::<&str>().unwrap();

0 commit comments

Comments
 (0)