On Monday, August 5th, 2024 at 16:20, Pip Cet wrote: > "Eval Exec" execvy@gmail.com writes: > > > I wanted to help test the scratch/igc branch, so I compiled it from > > commit 42731228d24. > > Thank you for doing that! > > > Then I build it by > > ```bash > > make extraclean > > ./autogen.sh \ > > && ./configure \ > > --prefix=$(realpath ../emacs-build)\ > > --with-mps \ > > --with-imagemagick \ > > --with-modules --with-x-toolkit=lucid --without-compress-install \ > > --without-toolkit-scroll-bars --with-native-compilation --with-mailutils\ > > --with-tree-sitter --with-xinput2 \ > > --with-dbus --with-native-compilation=aot \ > > --with-file-notification=inotify\ > > && make -j20 install > > > Like Eli, I'm suspecting the Lucid widget code... > > > It works perfectly for the first hour, but then it crashes, and I > > don't know how to reproduce the issue. > > > > I think the crash is caused by "window size adjustments" > > ``` > > (gdb) bt > > #0 0x00007f47afea2efc in __pthread_kill_implementation () from > > /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6 > > #1 0x00007f47afe52e86 in raise () from > > /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6 > > #2 0x00000000004243a4 in terminate_due_to_signal (sig=sig@entry=8, > > backtrace_limit=backtrace_limit@entry=40) at emacs.c:470 > > #3 0x00000000004248fc in handle_fatal_signal (sig=sig@entry=8) at sysdep.c:1800 > > #4 0x000000000056f568 in deliver_thread_signal (sig=8, > > handler=0x4248f1 ) at sysdep.c:1792 > > #5 0x000000000056f669 in deliver_fatal_thread_signal (sig= > out>) at sysdep.c:1812 > > #6 > > #7 0x000000000069e35e in pixel_to_char_size > > (pixel_width=pixel_width@entry=482, > > pixel_height=pixel_height@entry=76, > > char_width=char_width@entry=0x7ffced20da38, > > char_height=char_height@entry=0x7ffced20da3c, > > ew=) at widget.c:172 > > > That code reads: > > static void > pixel_to_char_size (EmacsFrame ew, Dimension pixel_width, > Dimension pixel_height, int *char_width, int *char_height) > { > struct frame *f = ew->emacs_frame.frame; > > > *char_width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width); > *char_height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, (int) pixel_height); > } > > Which gets a frame pointer from a structure (ew) that MPS doesn't know > about; but frames can move, so that explains the bug, because MPS > doesn't know to update the pointer in the EmacsFrame structure. > > Unfortunately, the structure is allocated by XtCreateWidget, which calls > malloc(), IIUC. So it's not immediately obvious (to me) how to fix it. > My best idea so far is to create an ambiguous root covering the frame > pointer and store that in the structure instead. So I've done that, can you try the attached patch? This is a first stab (thus the ambiguous alloc), but it should prevent the crash we've seen. TODO list for this: - use precise alloc - check framep, not *framep, in EmacsFrameInitialize Pip