Subject: bug#76538: 31.0.50; 31.0.50; 31.0.50; feature/igc: using magit-section-cycle-global (S-TAB) and magit-section-toggle (TAB) in some random ways blocks GNU Emacs.

From: Gerd Möllmann <[email-masked]>
Date: Mon, 03 Mar 2025 10:16:10 +0100

Helmut Eller <[email-masked]> writes:

> On Mon, Mar 03 2025, Gerd Möllmann wrote:
>
>> Do you have a concrete scenario in mind?
>
> To increase the probability of the problem, let's call igc_collect from
> igc_add_marker, like so:
>
> diff --git a/src/igc.c b/src/igc.c
> index ec714cad435..9bf0a0eca91 100644
> --- a/src/igc.c
> +++ b/src/igc.c
> @@ -4595,7 +4595,9 @@ igc_add_marker (struct buffer *b, struct Lisp_Marker *m)
>  
>    IGC_MA_FREE_LIST (xv) = IGC_MA_MARKER (xv, slot);
>    IGC_MA_MARKER (xv, slot) = make_lisp_ptr (m, Lisp_Vectorlike);
> -  IGC_MA_NEXT (xv, slot) = IGC_MA_HEAD (xv);
> +  Lisp_Object head = IGC_MA_HEAD (xv);
> +  igc_collect ();
> +  IGC_MA_NEXT (xv, slot) = head;
>    IGC_MA_PREV (xv, slot) = make_fixnum (-1);
>    IGC_MA_HEAD (xv) = make_fixnum (slot);
>    ptrdiff_t next = XFIXNUM (IGC_MA_NEXT (xv, slot));
>
> Then, run the code below with
>
>   ./src/emacs -Q -batch -l /tmp/m.el -f test
>
> For me, Emacs seems to enter an endless loop after creating 36 markers.
>
> Helmut

That's not what I meant, sorry, let me try to ask differently. Without
modifying the code, which situation would you call risky? Is it a signal
that interrupts the mutator, at the place above for instance? And then
lets MPS do what? Or is it a concern for the case that MPS becomes
concurrent?

Sorry if I'm a bit dense today. It's Rosenmontag, after all :-).