XInput2 MD without SD again

Peter Hutterer peter.hutterer at who-t.net
Thu Dec 18 15:08:05 PST 2008


On Thu, Dec 18, 2008 at 07:36:01PM +0100, Christian Beier wrote:
> On Wed, 17 Dec 2008 12:14:22 +1000
> Peter Hutterer <peter.hutterer at who-t.net> wrote:
> 
> > On Tue, Dec 16, 2008 at 05:16:19PM +0100, Christian Beier wrote:
> > > Oh and well, while we're at it: adding more than 6 or 7 MDs crashes the
> > > Xserver.  Try 'xinput create-master foo' six or more times. I think I'll
> > > file another bug...
> >
> > crash the server or FatalError it? I just tried it in here and it works fine.
> >
> > Do you have d507f60689f4e14383b0d24e63afc8cf836360d5 xfree86: don't FatalError
> > on "too many input devices"?
> 
> Yep, I have that.  I use an Xorg build from 15. December 2008.
> Funny thing is, i wanted to reproduce the bug, and i could create MDs
> up to id 19, then xinput bailed out with a BadAlloc error. Seems
> everything was working. _But_ then I added another mouse to the laptop
> and tried creating MDs up to the limit again, and voila: Got a Fatal
> server error...

thanks. The trigger is that the poiner creation succeeds, but the keyboard
creation in fails. The server then tries to remove the pointer device which
segfaults. The patch below fixes this.

Cheers,
  Peter

>From 317120a3f18bd060c1744b0cdf27067386ea5cf2 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri, 19 Dec 2008 08:56:35 +1000
Subject: [PATCH] dix: don't disable uninitialized devices.

If a device hasn't been initialized, it doesn't have a cursor yet. So don't
set the cursor to the NullCursor, and don't try to DisableDevice either.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/devices.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dix/devices.c b/dix/devices.c
index 48b6e7d..ff6f0ec 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -965,11 +965,15 @@ RemoveDevice(DeviceIntPtr dev)
         return BadImplementation;
 
     initialized = dev->inited;
-    if (DevHasCursor(dev))
-        screen->DisplayCursor(dev, screen, NullCursor);
-
     deviceid = dev->id;
-    DisableDevice(dev);
+
+    if (initialized)
+    {
+        if (DevHasCursor(dev))
+            screen->DisplayCursor(dev, screen, NullCursor);
+
+        DisableDevice(dev);
+    }
 
     prev = NULL;
     for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
-- 
1.6.0.4





More information about the xorg mailing list