Subject: Re: bug#56869: 29.0.50; segfault, "assertion 'GDK_IS_DEVICE (device)' failed"
From: Stefan Kangas <[email-masked]>
To: Po Lu <[email-masked]>
Cc: Joe Corneli <[email-masked]>, [email-masked]
Date: Sun, 3 Sep 2023 02:13:35 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Po Lu <[email-masked]> writes:

> tags 56869 wontfix
> thanks
>
> Joe Corneli <[email-masked]> writes:
>
>> OK, here’s the info:
>>
>> (gdb) p xev->sourceid
>> $1 = 12
>>
>> $ xinput list
>> ⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
>> ⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
>> ⎜   ↳ MSFT0001:01 06CB:CD64 Mouse             	id=11	[slave  pointer  (2)]
>> ⎜   ↳ MSFT0001:01 06CB:CD64 Touchpad          	id=12	[slave  pointer  (2)]
>> ⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
>>     ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
>>     ↳ Power Button                            	id=6	[slave  keyboard (3)]
>>     ↳ Video Bus                               	id=7	[slave  keyboard (3)]
>>     ↳ Power Button                            	id=8	[slave  keyboard (3)]
>>     ↳ Sleep Button                            	id=9	[slave  keyboard (3)]
>>     ↳ Intel HID events                        	id=13	[slave  keyboard (3)]
>>     ↳ AT Translated Set 2 keyboard            	id=14	[slave  keyboard (3)]
>>     ↳ Chicony USB2.0 Camera: Chicony          	id=10	[slave  keyboard (3)]
>>
>>
>> ... and another possible clue, which is that I’m running Touchpad
>> Indicator, https://github.com/atareao/Touchpad-Indicator
>>
>> and I have it set up to disable the trackpad _while typing_.  Perhaps
>> the way it enables and disables the trackpad is currently interacting
>> with Emacs in a glitchy way.
>
> Right, I think I know what this is now.  GTK fails to read information
> about the trackpad due to it being disabled between the
> XI_HierarchyChange event being sent and and it being handled.  GTK then
> segfaults trying to access a field in a device it doesn't know about.
>
> This only shows up in Emacs, because most other GTK programs do not make
> people rapidly alternate between trackpad and keyboard use.
>
> I suggest using a build of Emacs without GTK.  If you have to use GTK,
> turn off '--with-xinput2', but as a result several features will no
> longer work.
>
> Thanks.
>
> BTW, the quality of the GDK X11 backend has lately dropped to a very low
> level.  I'm going to push for the Emacs build to default to the Motif or
> no-toolkit build instead.

Thanks, so it seems like the solution is to use a build without GTK or
'--with-xinput2'.  I'm therefore closing this bug report.