[PATCH joystick] Remove old input ABI leftovers from jstkCoreUnInit

Peter Hutterer peter.hutterer at who-t.net
Mon Mar 21 23:42:06 PDT 2011


On Fri, Mar 18, 2011 at 07:13:38PM +0200, Timo Aaltonen wrote:
> From: Timo Aaltonen <timo.aaltonen at canonical.com>
> 
> Fixes crashes on device unplug:
> https://bugs.freedesktop.org/show_bug.cgi?id=35391
> 
> Signed-off-by: Timo Aaltonen <timo.aaltonen at canonical.com>
> ---
>  src/jstk.c |    7 -------
>  1 files changed, 0 insertions(+), 7 deletions(-)
> 
> diff --git a/src/jstk.c b/src/jstk.c
> index 9796a46..41cace7 100644
> --- a/src/jstk.c
> +++ b/src/jstk.c
> @@ -622,13 +622,6 @@ jstkCoreUnInit(InputDriverPtr    drv,
>  {
>      JoystickDevPtr device = (JoystickDevPtr) pInfo->private;
>  
> -    if (device->keyboard_device != NULL)
> -    {
> -        xf86DisableDevice(device->keyboard_device->dev, TRUE);
> -        device->keyboard_device = NULL;
> -    }

that's not quite enough. we still support ABI 11. in theory anyway, I don't
think either has been actually tested on a device.
so the if condition removal should go into a ifdef ABI >= 12

alternatively, you could just up the driver to only support ABI 12. as long
as no-one steps up to maintain it, I'm happy to keep it in lockstep with the
server at least.
> -
> -    free (device);

some comment explainig _why_ this fixes the crash in the commit message
would have been nice.

turns out that pInfo->private is shared between the keyboard device and the 
actual device and this would cause a double free.

and the condition above is obsolete because with input ABI 12, devices that
are hotplugged through the driver are removed by the server now.

Cheers,
  Peter
  
>      pInfo->private = NULL;
>      xf86DeleteInput(pInfo, 0);
>  }
> -- 
> 1.7.4.1



More information about the xorg-devel mailing list