aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Colascione2014-02-15 21:46:05 -0800
committerDaniel Colascione2014-02-15 21:46:05 -0800
commitfa8ac13cbabeee7348f97edf25c8411b1a4528d3 (patch)
tree42035963b7f08154493310deeb6ed81794db82f9 /src
parent17d1b51b659eb68c559e70a00db5e5316e24bdad (diff)
parent0b87142f24a5dd0d81c26aeea21feec50bbc1044 (diff)
downloademacs-fa8ac13cbabeee7348f97edf25c8411b1a4528d3.tar.gz
emacs-fa8ac13cbabeee7348f97edf25c8411b1a4528d3.zip
Make closing dbus buses actually work
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/dbusbind.c18
2 files changed, 24 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bcaa0fddcee..0afc5d39b2f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12014-02-16 Daniel Colascione <dancol@dancol.org>
2
3 * dbusbind.c (xd_lisp_dbus_to_dbus): New function.
4 (xd_get_connection_address): Use it.
5 (xd_close_bus): Use xd_lisp_dbus_to_dbus to instead of
6 xd_get_connection_address because the latter signals if the bus
7 we're trying to close is already disconnected.
8
12014-02-13 Eli Zaretskii <eliz@gnu.org> 92014-02-13 Eli Zaretskii <eliz@gnu.org>
2 10
3 * w32proc.c (start_timer_thread): Pass a non-NULL pointer as last 11 * w32proc.c (start_timer_thread): Pass a non-NULL pointer as last
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 */
977static DBusConnection*
978xd_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. */
978static DBusConnection * 985static 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 {