[PATCH:libXi] Initialize extension with the right number of events.

Julien Cristau jcristau at debian.org
Wed Feb 3 15:17:25 PST 2010


On Wed, Dec  9, 2009 at 14:06:36 +1000, Peter Hutterer wrote:

>  _X_HIDDEN
>  XExtDisplayInfo *XInput_find_display (Display *dpy)
>  {
> @@ -180,10 +237,12 @@ XExtDisplayInfo *XInput_find_display (Display *dpy)
>      if (!xinput_info) { if (!(xinput_info = XextCreateExtension())) return NULL; }
>      if (!(dpyinfo = XextFindDisplay (xinput_info, dpy)))
>      {
> +      int nevents = _XiFindEventsSupported(dpy);
> +
>        dpyinfo = XextAddDisplay (xinput_info, dpy,
>                                  xinput_extension_name,
>                                  &xinput_extension_hooks,
> -                                IEVENTS, NULL);
> +                                nevents, NULL);
>        XESetWireToEventCookie(dpy, dpyinfo->codes->major_opcode, XInputWireToCookie);
>        XESetCopyEventCookie(dpy, dpyinfo->codes->major_opcode, XInputCopyCookie);
>      }

Apparently this makes qt3 apps crash when running on a server with no
XInputExtension.

qt_init_internal calls XListInputDevices (even without XI; bad qt!), and
XextAddDisplay returns here with dpyinfo->codes == NULL, so we crash on
the next line.

Reported as http://bugs.debian.org/568323 and reproduced with Xvfb
-extension XInputExtension (with an old Xvfb, since XI is mandatory
nowadays).

Cheers,
Julien


More information about the xorg-devel mailing list