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

From: Tim Cross <[email-masked]>
Date: Sun, 16 Feb 2025 09:16:57 +1100

That seems to have fixed the issue. Running emacs built with --with-pgtk
now works and does not core dump under Plasma 6.3 on Fedora 41 with all
recent updates applied.

Pip Cet <[email-masked]> writes:

> "Tim Cross" <[email-masked]> writes:
>
>> Just confirming I'm also seeing this same error since the update to
>> Plasma 63 on Fedora 41. However, this issue seems specific to Plasma 6.3
>> and may not be an emacs issue. The emacs pgtk build still seems to work
>> fine under other wayland compositors such as Sway and Hyprland. Would
>> indicate this is either specific to Plasma 6.3 or to Fedora's packaging
>> of Plasma 6.3.
>>
>> Emacs was working fune prior to the update to Plasma 6.3 with pgtk build
>> under wayland.
>
> Can you try this patch?
>
> From 053c40aa589b410d6e6b3534314338966704d9a7 Mon Sep 17 00:00:00 2001
> From: Pip Cet <[email-masked]>
> Subject: [PATCH] Ignore NULL devices returned by gdk_seat_get_devices
>  (bug#76239)
>
> * src/pgtkterm.c (pgtk_enumerate_devices): Ignore NULL list entries.
> ---
>  src/pgtkterm.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/pgtkterm.c b/src/pgtkterm.c
> index dd85d622a62..a41cd115052 100644
> --- a/src/pgtkterm.c
> +++ b/src/pgtkterm.c
> @@ -182,6 +182,9 @@ pgtk_enumerate_devices (struct pgtk_display_info *dpyinfo,
>  
>        for (t1 = devices_on_seat; t1; t1 = t1->next)
>  	{
> +	  /* Bug#76239, GTK bug TBD */
> +	  if (t1->data == NULL)
> +	    continue;
>  	  rec = xmalloc (sizeof *rec);
>  	  rec->seat = g_object_ref (seat);
>  	  rec->device = GDK_DEVICE (t1->data);