Subject: bug#76239: crash with "gdk_device_get_name: assertion 'GDK_IS_DEVICE (device)' failed" error on kde 6.3, fedora 41

From: Po Lu <[email-masked]>
Date: Sat, 15 Feb 2025 21:13:32 +0800

Pip Cet <[email-masked]> writes:

> "Eli Zaretskii" <[email-masked]> writes:
>
>>> From: समीर सिंह Sameer Singh
>>>  <[email-masked]>
>>> Date: Thu, 13 Feb 2025 02:21:00 +0530
>>>
>>> after upgrading to kde 6.3 on my fedora 41 machine, emacs fails to
>>> start with the following error
>>> ---------------------------------------------------------------------------------------------------------------
>>> (emacs:84925): Gdk-CRITICAL **: 02:00:31.252: gdk_device_get_name:
>>> assertion 'GDK_IS_DEVICE (device)' failed
>>
>> Po Lu, any comments or suggestions?
>
> This bug probably became more apparent with the recent change to use
> doprnt.c for make_formatted_string, which crashes when passed a NULL
> string rather than printing "(nil)" as glibc does.  We might want to
> change that, though the underlying bug needs to be fixed, too.
>
>>> #4  0x0000000000748c4b in pgtk_enumerate_devices (dpyinfo=0xb3a100,
>>> initial_p=true) at pgtkterm.c:188
>>>         rec = 0xc8a6f0
>>>         all_seats = 0xba6c30 = {0xa57ec0}
>>>         devices_on_seat = 0xba6c50 = {0x0, 0xa41920, 0x9e9800,
>>> 0xb05da0, 0xa8b210}
>
> If this is to be believed, the return value of gdk_seat_get_slaves
> (renamed to gdk_seat_get_devices in 2020, it seems) contained a NULL
> pointer?
>
> Looking at gdkseat-wayland.c, it seems most likely to be
> 9f4320a4acbc104a8fce09c0a948d0f99e0feb98, which leaves a tablet pad's
> ->device pointer as NULL until it "enters" a surface:
>
> https://github.com/GNOME/gtk/commit/9f4320a4acbc104a8fce09c0a948d0f99e0feb98
>
> Do you have something that would count as a tablet pad?
>
> Pip

Thanks.  This is certainly a bug in GDK, which I suggest reporting to
their developers, and for the present I will install a workaround in
emacs-30 tomorrow.