[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MPS: Crash when switching to buffer
From: |
Gerd Möllmann |
Subject: |
Re: MPS: Crash when switching to buffer |
Date: |
Tue, 02 Jul 2024 06:04:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Pip Cet <pipcet@protonmail.com> writes:
> Thanks, that helps clarify things. So would something like the
> following work? lface_id_to_name is never freed, it seems...
Yes, that works 👍
> Ihor, I'm not sure whether the bug is fully reproducible. If it is, could you
> please try this?
>
> diff --git a/src/xfaces.c b/src/xfaces.c
> index 2bdd2f660fd..ee26a260ed4 100644
> --- a/src/xfaces.c
> +++ b/src/xfaces.c
> @@ -2970,9 +2970,15 @@ DEFUN ("internal-make-lisp-face",
> Finternal_make_lisp_face,
> The mapping from Lisp face to Lisp face id is given by the
> property `face' of the Lisp face name. */
> if (next_lface_id == lface_id_to_name_size)
> +#ifdef HAVE_MPS
> + lface_id_to_name =
> + igc_xpalloc_ambig (lface_id_to_name, &lface_id_to_name_size, 1,
> MAX_FACE_ID,
> + sizeof *lface_id_to_name);
> +#else
> lface_id_to_name =
> xpalloc (lface_id_to_name, &lface_id_to_name_size, 1, MAX_FACE_ID,
> sizeof *lface_id_to_name);
> +#endif
>
> Lisp_Object face_id = make_fixnum (next_lface_id);
> lface_id_to_name[next_lface_id] = face;
> @@ -7326,7 +7332,11 @@ init_xfaces (void)
> {
> /* Allocate the lface_id_to_name[] array. */
> lface_id_to_name_size = next_lface_id = nfaces;
> +#ifdef HAVE_MPS
> + lface_id_to_name = igc_xzalloc_ambig (next_lface_id * sizeof
> *lface_id_to_name);
> +#else
> lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
> +#endif
>
> /* Store the faces. */
> struct Lisp_Hash_Table* table = XHASH_TABLE
> (Vface_new_frame_defaults);
Alternatively, we could also use
Lisp_Object *igc_alloc_lisp_obj_vec (size_t n)
to allocate the vector. That returns an object of type IGC_OBJ_OBJ_VEC
in MPS that eventually gets collected. We would then have to use
void igc_root_create_exact_ptr (void *var_addr)
for the variable holding the reference to the object, where the
staticpros are done.
Just wanted to mention that this also exists, and has the advantage of
fewer ambiguous references.
- MPS: Crash when switching to buffer, Ihor Radchenko, 2024/07/01
- Re: MPS: Crash when switching to buffer, Eli Zaretskii, 2024/07/01
- Re: MPS: Crash when switching to buffer, Ihor Radchenko, 2024/07/01
- Re: MPS: Crash when switching to buffer, Pip Cet, 2024/07/01
- Re: MPS: Crash when switching to buffer, Gerd Möllmann, 2024/07/01
- Re: MPS: Crash when switching to buffer, Pip Cet, 2024/07/01
- Re: MPS: Crash when switching to buffer,
Gerd Möllmann <=
- Re: MPS: Crash when switching to buffer, Ihor Radchenko, 2024/07/02
- Re: MPS: Crash when switching to buffer, Ihor Radchenko, 2024/07/04
- Re: MPS: Crash when switching to buffer, Gerd Möllmann, 2024/07/04
- MPS: User GC customizations (was: MPS: Crash when switching to buffer), Ihor Radchenko, 2024/07/04
- Re: MPS: User GC customizations, Gerd Möllmann, 2024/07/04
- Re: MPS: User GC customizations, Ihor Radchenko, 2024/07/04
- Re: MPS: User GC customizations, Gerd Möllmann, 2024/07/04
- Re: MPS: User GC customizations, Pip Cet, 2024/07/04
- Re: MPS: User GC customizations, Gerd Möllmann, 2024/07/04
- Re: MPS: User GC customizations, Ihor Radchenko, 2024/07/04