On Tuesday, July 2nd, 2024 at 15:14, Ihor Radchenko wrote: > Pip Cet pipcet@protonmail.com writes: > > > Oops, turns out you shouldn't double free just to be sure. > > > > Can you try the attached patch? I was able to trigger your bug by running > > > > ./emacs -Q --eval "(while t (menu-bar-mode 'toggle) (sit-for 0.1))" > > > > The change is in menu_destroy_callback, which passed through the wrong pointer. > > > No immediate crashes now. > I will keep this session running, with your patches installed. Thanks! Here's what I'm testing now, FWIW. Eli, is this sufficiently isolated from the non-MPS case? We use some trivial wrapper macros which become non-trivial in the MPS case, and we always use a slightly more verbose glib function to register handlers (and, in the MPS case, a cleanup handler). Pip