From 7721ee308fbbb6fc9c969f15fe04b3346c04f843 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 7 Aug 2006 23:03:02 +0300 Subject: [PATCH] config client: fix minor race with event queue Fix a small race whereby you could remove a device while events from it were still in the queue, by calling ProcessInputEvents immediately before RemoveDevice, to (hopefully) flush the event queue. --- config/config.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/config.c b/config/config.c index b85b12028..d4cf23334 100644 --- a/config/config.c +++ b/config/config.c @@ -173,6 +173,10 @@ configMessage(DBusConnection *connection, DBusMessage *message, void *closure) return DBUS_HANDLER_RESULT_HANDLED; } ErrorF("pDev is %p\n", pDev); + /* Call PIE here so we don't try to dereference a device that's + * already been removed. Technically there's still a small race + * here, so we should ensure that SIGIO is blocked. */ + ProcessInputEvents(); RemoveDevice(pDev); dbus_error_free(&error); return DBUS_HANDLER_RESULT_HANDLED;