summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2013-02-11 14:31:56 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2013-04-02 15:36:27 +1000
commit4bd8e9ecc3dedb876b90b64fb8b140576d5a7b0b (patch)
tree12fe701a6b7a830f9873d1d3912a72f4f7af903b
parenteec5eb2f09682718e69f42491181ade0b093f52d (diff)
xf86: use nt_list_for_each_entry_safe to walk InputHandlers in xf86Wakeup
This is necessary when the input handler deletes itself from the list. Bug found by Maarten Lankhorst, this patch uses the list macros instead of open-coding the fix. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit da92690107d90061205340d4cdc98b73b59db9b2)
-rw-r--r--hw/xfree86/common/xf86Events.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 7e80fa922..b19553a32 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -272,9 +272,9 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
}
if (err >= 0) { /* we don't want the handlers called if select() */
- IHPtr ih; /* returned with an error condition, do we? */
+ IHPtr ih, ih_tmp; /* returned with an error condition, do we? */
- for (ih = InputHandlers; ih; ih = ih->next) {
+ nt_list_for_each_entry_safe(ih, ih_tmp, InputHandlers, next) {
if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
(FD_ISSET(ih->fd, ((fd_set *) pReadmask)) != 0)) {
ih->ihproc(ih->fd, ih->data);