summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@space-ghost.verbum.private>2008-03-31 18:20:07 -0400
committerColin Walters <walters@space-ghost.verbum.private>2008-03-31 18:20:07 -0400
commit0bfc5e8d23a5ae56eee5ef2073911cddcbd0c4b0 (patch)
treef0f29ad08e8afbc0c3450b717b07f086cf3a0bc2
parent193ebb7083fb1e9dccff04fc0a9d805a0aa03ea2 (diff)
Check for X11 events before selecting (FDO bug #15293)
-rw-r--r--ChangeLog9
-rw-r--r--tools/dbus-launch.c18
2 files changed, 21 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 4cd19aab..56280156 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2008-03-26 Colin Walters <walters@verbum.org>
+2008-03-31 Colin Walters <walters@verbum.org>
+
+ Patch from Owen Taylor <otaylor@redhat.com>
+
+ * tools/dbus-launch-x11.c: Check for X11 events before
+ selecting (FDO bug #15293)
+
+2008-03-31 Colin Walters <walters@verbum.org>
Patch from Owen Taylor <otaylor@redhat.com>
diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c
index 6a10ffa3..216f7435 100644
--- a/tools/dbus-launch.c
+++ b/tools/dbus-launch.c
@@ -458,6 +458,17 @@ kill_bus_when_session_ends (void)
while (TRUE)
{
+#ifdef DBUS_BUILD_X11
+ /* Dump events on the floor, and let
+ * IO error handler run if we lose
+ * the X connection. It's important to
+ * run this before going into select() since
+ * we might have queued outgoing messages or
+ * events.
+ */
+ x11_handle_event ();
+#endif
+
FD_ZERO (&read_set);
FD_ZERO (&err_set);
@@ -472,7 +483,7 @@ kill_bus_when_session_ends (void)
FD_SET (x_fd, &read_set);
FD_SET (x_fd, &err_set);
}
-
+
select (MAX (tty_fd, x_fd) + 1,
&read_set, NULL, &err_set, NULL);
@@ -483,15 +494,12 @@ kill_bus_when_session_ends (void)
}
#ifdef DBUS_BUILD_X11
- /* Dump events on the floor, and let
- * IO error handler run if we lose
- * the X connection
+ /* Events will be processed before we select again
*/
if (x_fd >= 0)
verbose ("X fd condition reading = %d error = %d\n",
FD_ISSET (x_fd, &read_set),
FD_ISSET (x_fd, &err_set));
- x11_handle_event ();
#endif
if (tty_fd >= 0)