[PATCH 4/5] xfree86: Fix xf86SetConsoleHandler to juggle the right pointers.
Peter Hutterer
peter.hutterer at who-t.net
Wed Aug 10 20:03:13 PDT 2011
xf86AddGeneralHandler takes a handler_proc but returns an IHPtr.
xf86RemoveGeneralHandler takes a IHPtr, not a handler_proc. Save the
returned IHPtr (which is allocated, thus save for us to store here) and
remove it instead of passing the wrong pointer to xf86RemoveGeneralHandler.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
hw/xfree86/common/xf86Events.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index c4a4db9..a4bad60 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -602,12 +602,13 @@ InputHandlerProc
xf86SetConsoleHandler(InputHandlerProc proc, pointer data)
{
static InputHandlerProc handler = NULL;
+ static IHPtr ih = NULL;
InputHandlerProc old_handler = handler;
- if (old_handler)
- xf86RemoveGeneralHandler(old_handler);
+ if (old_handler && ih)
+ xf86RemoveGeneralHandler(ih);
- xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
+ ih = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
handler = proc;
return old_handler;
--
1.7.6
More information about the xorg-devel
mailing list