diff options
| author | Daniel Colascione | 2014-02-15 21:46:05 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2014-02-15 21:46:05 -0800 |
| commit | fa8ac13cbabeee7348f97edf25c8411b1a4528d3 (patch) | |
| tree | 42035963b7f08154493310deeb6ed81794db82f9 /src/dbusbind.c | |
| parent | 17d1b51b659eb68c559e70a00db5e5316e24bdad (diff) | |
| parent | 0b87142f24a5dd0d81c26aeea21feec50bbc1044 (diff) | |
| download | emacs-fa8ac13cbabeee7348f97edf25c8411b1a4528d3.tar.gz emacs-fa8ac13cbabeee7348f97edf25c8411b1a4528d3.zip | |
Make closing dbus buses actually work
Diffstat (limited to 'src/dbusbind.c')
| -rw-r--r-- | src/dbusbind.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c index 5680eacd9b2..f6df5107db1 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -973,6 +973,13 @@ xd_get_connection_references (DBusConnection *connection) | |||
| 973 | return *refcount; | 973 | return *refcount; |
| 974 | } | 974 | } |
| 975 | 975 | ||
| 976 | /* Convert a Lisp dbus object to a pointer */ | ||
| 977 | static DBusConnection* | ||
| 978 | xd_lisp_dbus_to_dbus (Lisp_Object bus) | ||
| 979 | { | ||
| 980 | return (DBusConnection *) (intptr_t) XFASTINT (bus); | ||
| 981 | } | ||
| 982 | |||
| 976 | /* Return D-Bus connection address. BUS is either a Lisp symbol, | 983 | /* Return D-Bus connection address. BUS is either a Lisp symbol, |
| 977 | :system or :session, or a string denoting the bus address. */ | 984 | :system or :session, or a string denoting the bus address. */ |
| 978 | static DBusConnection * | 985 | static DBusConnection * |
| @@ -985,7 +992,7 @@ xd_get_connection_address (Lisp_Object bus) | |||
| 985 | if (NILP (val)) | 992 | if (NILP (val)) |
| 986 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); | 993 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
| 987 | else | 994 | else |
| 988 | connection = (DBusConnection *) (intptr_t) XFASTINT (val); | 995 | connection = xd_lisp_dbus_to_dbus (val); |
| 989 | 996 | ||
| 990 | if (!dbus_connection_get_is_connected (connection)) | 997 | if (!dbus_connection_get_is_connected (connection)) |
| 991 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); | 998 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
| @@ -1080,14 +1087,21 @@ xd_close_bus (Lisp_Object bus) | |||
| 1080 | { | 1087 | { |
| 1081 | DBusConnection *connection; | 1088 | DBusConnection *connection; |
| 1082 | Lisp_Object val; | 1089 | Lisp_Object val; |
| 1090 | Lisp_Object busobj; | ||
| 1083 | 1091 | ||
| 1084 | /* Check whether we are connected. */ | 1092 | /* Check whether we are connected. */ |
| 1085 | val = Fassoc (bus, xd_registered_buses); | 1093 | val = Fassoc (bus, xd_registered_buses); |
| 1086 | if (NILP (val)) | 1094 | if (NILP (val)) |
| 1087 | return; | 1095 | return; |
| 1088 | 1096 | ||
| 1097 | busobj = CDR_SAFE(val); | ||
| 1098 | if (NILP (val)) { | ||
| 1099 | xd_registered_buses = Fdelete (val, xd_registered_buses); | ||
| 1100 | return; | ||
| 1101 | } | ||
| 1102 | |||
| 1089 | /* Retrieve bus address. */ | 1103 | /* Retrieve bus address. */ |
| 1090 | connection = xd_get_connection_address (bus); | 1104 | connection = xd_lisp_dbus_to_dbus (busobj); |
| 1091 | 1105 | ||
| 1092 | if (xd_get_connection_references (connection) == 1) | 1106 | if (xd_get_connection_references (connection) == 1) |
| 1093 | { | 1107 | { |