Since libxi 1.7.7 GTK2 applications crash when certain input devices are plugged in. At least some Wacom tablets and Microsoft game controllers trigger a segmentation fault. Removing lines 224 and 225 from src/XListDev.c:XListInputDevices
prevents the error from happening. These lines were added in commit 19a9cd6, the only commit from 1.7.6 to 1.7.7.
Created attachment 127213 [details] [review]
Jan de Groot observed (https://bugs.archlinux.org/task/51298) that the problem is caused by gtk not checking a return value for NULL. As the man page for xlistinputdevices says nothing about return values, the best we could do is to behave the best we can and not set any call-by-reference value when we may fail and return NULL. This prevents gtk from trying to loop over a NULL array.
Of course, the patch does not address the actual bug that SizeClassInfo sometimes returns 0 and causes XListInputDevices to bail out.
GTK notes that at the very least the documentation is wrong and 1.7.7 diverged from the documented behavior by no longer returning at least the core pointer.
Apparently the bug tracker is not a central place of development, as my patch was reinvented on the mailing list: https://lists.freedesktop.org/archives/xorg-devel/2016-October/051608.html
-- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/lib/libxi/issues/8.