Commit 777013f2 authored by Michael Albinus's avatar Michael Albinus

* dbusbind.c (xd_add_watch): Improve debug message.

(xd_remove_watch): Improve debug message.  If DATA is the session
bus, unset D-Bus session environment.
(Fdbus_init_bus): Pass the bus as argument to
dbus_connection_set_watch_functions.  (Bug#5283)
parent 798c9eb5
2010-01-03 Michael Albinus <michael.albinus@gmx.de>
* dbusbind.c (xd_add_watch): Improve debug message.
(xd_remove_watch): Improve debug message. If DATA is the session
bus, unset D-Bus session environment.
(Fdbus_init_bus): Pass the bus as argument to
dbus_connection_set_watch_functions. (Bug#5283)
2010-01-01 Chong Yidong <cyd@stupidchicken.com> 2010-01-01 Chong Yidong <cyd@stupidchicken.com>
* nsterm.m (ns_get_color): Fix buffer overflow (Bug#4763). * nsterm.m (ns_get_color): Fix buffer overflow (Bug#4763).
...@@ -144,7 +152,7 @@ ...@@ -144,7 +152,7 @@
2009-12-15 Michael Albinus <michael.albinus@gmx.de> 2009-12-15 Michael Albinus <michael.albinus@gmx.de>
* dbusbind.c (xd_retrieve_arg): Reorder declarations in order to * dbusbind.c (xd_retrieve_arg): Reorder declarations in order to
avoid compiler warnings. (Bug #5217). avoid compiler warnings. (Bug #5217)
2009-12-14 Kenichi Handa <handa@m17n.org> 2009-12-14 Kenichi Handa <handa@m17n.org>
...@@ -5319,7 +5327,7 @@ ...@@ -5319,7 +5327,7 @@
(XD_SIGNAL1, XD_SIGNAL2, XD_SIGNAL3): New macros. Throw Qdbus_error. (XD_SIGNAL1, XD_SIGNAL2, XD_SIGNAL3): New macros. Throw Qdbus_error.
(xd_read_queued_messages): Catch Qdbus_error from the macros. (xd_read_queued_messages): Catch Qdbus_error from the macros.
(all): Replace xsignal1, xsignal2, xsignal3 by the respective (all): Replace xsignal1, xsignal2, xsignal3 by the respective
macro. (Bug#1186). macro. (Bug#1186)
2008-10-23 Ali Bahrami <ali_gnu@emvision.com> (tiny change) 2008-10-23 Ali Bahrami <ali_gnu@emvision.com> (tiny change)
......
...@@ -761,14 +761,14 @@ xd_add_watch (watch, data) ...@@ -761,14 +761,14 @@ xd_add_watch (watch, data)
if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE) if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
{ {
#if HAVE_DBUS_WATCH_GET_UNIX_FD #if HAVE_DBUS_WATCH_GET_UNIX_FD
/* TODO: Reverse these on Win32, which prefers the opposite. */ /* TODO: Reverse these on Win32, which prefers the opposite. */
int fd = dbus_watch_get_unix_fd(watch); int fd = dbus_watch_get_unix_fd(watch);
if (fd == -1) if (fd == -1)
fd = dbus_watch_get_socket(watch); fd = dbus_watch_get_socket(watch);
#else #else
int fd = dbus_watch_get_fd(watch); int fd = dbus_watch_get_fd(watch);
#endif #endif
XD_DEBUG_MESSAGE ("%d", fd); XD_DEBUG_MESSAGE ("fd %d", fd);
if (fd == -1) if (fd == -1)
return FALSE; return FALSE;
...@@ -781,7 +781,8 @@ xd_add_watch (watch, data) ...@@ -781,7 +781,8 @@ xd_add_watch (watch, data)
return TRUE; return TRUE;
} }
/* Remove connection file descriptor from input_wait_mask. */ /* Remove connection file descriptor from input_wait_mask. DATA is
the used bus, either QCdbus_system_bus or QCdbus_session_bus. */
void void
xd_remove_watch (watch, data) xd_remove_watch (watch, data)
DBusWatch *watch; DBusWatch *watch;
...@@ -791,18 +792,25 @@ xd_remove_watch (watch, data) ...@@ -791,18 +792,25 @@ xd_remove_watch (watch, data)
if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE) if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
{ {
#if HAVE_DBUS_WATCH_GET_UNIX_FD #if HAVE_DBUS_WATCH_GET_UNIX_FD
/* TODO: Reverse these on Win32, which prefers the opposite. */ /* TODO: Reverse these on Win32, which prefers the opposite. */
int fd = dbus_watch_get_unix_fd(watch); int fd = dbus_watch_get_unix_fd(watch);
if (fd == -1) if (fd == -1)
fd = dbus_watch_get_socket(watch); fd = dbus_watch_get_socket(watch);
#else #else
int fd = dbus_watch_get_fd(watch); int fd = dbus_watch_get_fd(watch);
#endif #endif
XD_DEBUG_MESSAGE ("%d", fd); XD_DEBUG_MESSAGE ("fd %d", fd);
if (fd == -1) if (fd == -1)
return; return;
/* Unset session environment. */
if ((data != NULL) && (EQ ((Lisp_Object) data, QCdbus_session_bus)))
{
XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
unsetenv ("DBUS_SESSION_BUS_ADDRESS");
}
/* Remove the file descriptor from input_wait_mask. */ /* Remove the file descriptor from input_wait_mask. */
delete_keyboard_wait_descriptor (fd); delete_keyboard_wait_descriptor (fd);
} }
...@@ -825,11 +833,12 @@ This is an internal function, it shall not be used outside dbus.el. */) ...@@ -825,11 +833,12 @@ This is an internal function, it shall not be used outside dbus.el. */)
/* Open a connection to the bus. */ /* Open a connection to the bus. */
connection = xd_initialize (bus); connection = xd_initialize (bus);
/* Add the watch functions. */ /* Add the watch functions. We pass also the bus as data, in order
to distinguish between the busses in xd_remove_watch. */
if (!dbus_connection_set_watch_functions (connection, if (!dbus_connection_set_watch_functions (connection,
xd_add_watch, xd_add_watch,
xd_remove_watch, xd_remove_watch,
NULL, NULL, NULL)) NULL, (void *) bus, NULL))
XD_SIGNAL1 (build_string ("Cannot add watch functions")); XD_SIGNAL1 (build_string ("Cannot add watch functions"));
/* Return. */ /* Return. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment