Subject: bug#75905: 31.0.50; feature/igc: crash when clicking menubar

From: Eli Zaretskii <[email-masked]>
Date: Tue, 28 Jan 2025 15:00:18 +0200

> From: Andrew Cohen <[email-masked]>
> Date: Tue, 28 Jan 2025 15:02:54 +0800
> 
> pgtk emacs with mpc crashes whenever the menubar is clicked. Same
> configuration without igc has no problem.
> 
> Thread 1 "emacs" received signal SIGABRT, Aborted.
> __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6,
>     no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
> warning: 44     ./nptl/pthread_kill.c: No such file or directory
> (gdb) bt full
> #0  __pthread_kill_implementation
>     (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
>     at ./nptl/pthread_kill.c:44
>         tid = <optimized out>
>         ret = 0
>         pd = <optimized out>
>         old_mask = {__val = {140737488338656}}
>         ret = <optimized out>
> #1  0x00007ffff1f1ddef in __pthread_kill_internal (threadid=<optimized out>, signo=6)
>     at ./nptl/pthread_kill.c:78
> #2  0x00007ffff1ec9d02 in __GI_raise (sig=6) at ../sysdeps/posix/raise.c:26
>         ret = <optimized out>
> #3  0x000055555574f608 in terminate_due_to_signal (sig=6, backtrace_limit=2147483647)
>     at emacs.c:470
> #4  0x00005555557f8d86 in die
>     (msg=0x555555a3a7c0 "((((struct vectorlike_header *) ((uintptr_t) ((void *) (globals.f_Vmenu_updating_frame).i) - (uintptr_t) ((Lisp_Word_tag) (Lisp_Vectorlike) << (1 ? 0 : VALBITS)))) ->size) & (PSEUDOVECTOR_FLAG | PVEC_"..., file=0x555555a3a76a "pgtkmenu.c", line=252) at alloc.c:8388
> #5  0x0000555555972366 in set_frame_menubar (f=0x5555565996b0, deep_p=true) at pgtkmenu.c:252

This is here:

  void
  set_frame_menubar (struct frame *f, bool deep_p)
  {
    GtkWidget *menubar_widget;
    Lisp_Object items;
    widget_value *wv, *first_wv, *prev_wv = 0;
    int i;
    int *submenu_start, *submenu_end;
    bool *submenu_top_level_items;
    int *submenu_n_panes;

    menubar_widget = f->output_data.pgtk->menubar_widget;

    XSETFRAME (Vmenu_updating_frame, f);  <<<<<<<<<<<<<<<<<<<<<<

Is this because vectorlike_header is a struct, not a union on the igc
branch?

Andrew, do other mouse clicks cause crashes like this one, in
XSETFRAME?