all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: 71929@debbugs.gnu.org, spwhitton@spwhitton.name
Subject: bug#71929: 30.0.60; crash in mark_image_cache
Date: Fri, 05 Jul 2024 10:37:23 +0300	[thread overview]
Message-ID: <86frso70i4.fsf@gnu.org> (raw)
In-Reply-To: <871q4849yc.fsf@yahoo.com> (message from Po Lu on Fri, 05 Jul 2024 14:41:31 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: Sean Whitton <spwhitton@spwhitton.name>,  71929@debbugs.gnu.org
> Date: Fri, 05 Jul 2024 14:41:31 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Sean Whitton <spwhitton@spwhitton.name>
> >> Cc: 71929@debbugs.gnu.org
> >> Date: Fri, 05 Jul 2024 08:13:14 +0800
> >> 
> >> Hello,
> >> 
> >> On Thu 04 Jul 2024 at 09:03am +03, Eli Zaretskii wrote:
> >> 
> >> >> What is the value of c->images?  IOW, why did this line segfault?
> >> >
> >> > Also, what is the value of c->refcount?
> >> 
> >> (gdb) p c
> >> $1 = (struct image_cache *) 0x555557c89e20
> >> (gdb) xpr
> >> There is no member named i.
> >> 
> >> (gdb) p c->images
> >> $2 = (struct image **) 0x35
> >> (gdb) xpr
> >> Cannot access memory at address 0x35
> >> 
> >> (gdb) p c->refcount
> >> $4 = 93823560581177
> >
> > So it's garbled.
> >
> > Po Lu, how do we handle the "shared" image cache when a frame is
> > deleted?  Where's the code which frees the cache if the cache's
> > refcount is one when the frame is deleted?
> 
> There's only one caller of free_image_cache, free_frame_faces, which is
> only called once in a frame's existence.  Cache refcounts are also
> altered from gui_set_font, but this process never entails decrementing a
> refcount to zero, as the caches under consideration are always retained
> by one or more frames:
> 
>   iwidth = max (10, FRAME_COLUMN_WIDTH (f));
>   if (FRAME_IMAGE_CACHE (f)
>       && (iwidth != FRAME_IMAGE_CACHE (f)->scaling_col_width))
>     {
>       eassert (FRAME_IMAGE_CACHE (f)->refcount >= 1);
>       if (FRAME_IMAGE_CACHE (f)->refcount == 1)
> 	{
> 	  /* This frame is the only user of this image cache.  */
> 	  FRAME_IMAGE_CACHE (f)->scaling_col_width = iwidth;
> 	  /* Clean F's image cache of images whose values are derived
> 	     from the font width.  */
> 	  clear_image_cache (f, Qauto);
> 	}
>       else
> 	{
> 	  /* Release the current image cache, and reuse or allocate a
> 	     new image cache with IWIDTH.  */
> 	  FRAME_IMAGE_CACHE (f)->refcount--;
> 	  FRAME_IMAGE_CACHE (f) = share_image_cache (f);
> 	  FRAME_IMAGE_CACHE (f)->refcount++;
> 	}
>     }

How does this answer my question?

The use case I was thinking of is that the image cache was shared,
then the last frame which shared the cache was deleted.  How do we
make sure the cache is freed and set to NULL in this situation?

IOW, we seem to have a cache that is not NULL but is also not a real
cache, as it cannot be accessed.  The question is how did that happen?





  reply	other threads:[~2024-07-05  7:37 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04  2:33 bug#71929: 30.0.60; crash in mark_image_cache Sean Whitton
2024-07-04  2:44 ` Sean Whitton
2024-07-04  5:53   ` Eli Zaretskii
2024-07-04  6:03     ` Eli Zaretskii
2024-07-04  6:17       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-04  6:42         ` Sean Whitton
2024-07-04  6:59           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-04  9:56             ` Sean Whitton
2024-07-04 12:28               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05  7:52                 ` Sean Whitton
2024-07-04  7:40           ` Eli Zaretskii
2024-07-04  9:57             ` Sean Whitton
2024-07-04 12:48               ` Eli Zaretskii
2024-07-05  0:13       ` Sean Whitton
2024-07-05  6:27         ` Eli Zaretskii
2024-07-05  6:41           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05  7:37             ` Eli Zaretskii [this message]
2024-07-05  9:36               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05 11:10                 ` Eli Zaretskii
2024-07-05 11:40                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05 12:46                     ` Sean Whitton
2024-07-06  2:41                     ` Sean Whitton
2024-07-06  6:08                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-07  2:40                         ` Sean Whitton
2024-07-07  2:43                         ` Sean Whitton
2024-07-07  2:46                           ` Sean Whitton
2024-07-07  4:04                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-07  4:54                               ` Sean Whitton
2024-07-07  7:08                                 ` Eli Zaretskii
2024-07-07  7:41                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-07 13:16                                     ` Sean Whitton
2024-07-07 13:47                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-07 14:45                                         ` Sean Whitton
2024-07-09  5:48                                         ` Sean Whitton
2024-07-09 11:37                                           ` Eli Zaretskii
2024-07-10  1:12                                             ` Sean Whitton
2024-07-09 12:13                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-09 13:44                                             ` Sean Whitton
2024-07-09 14:03                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-09 14:18                                                 ` Eli Zaretskii
2024-07-09 15:02                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-09 15:45                                                     ` Eli Zaretskii
2024-07-10  1:12                                                 ` Sean Whitton
2024-07-24 13:31                                                   ` Basil L. Contovounesios
2024-07-24 13:38                                                     ` Eli Zaretskii
2024-07-24 14:10                                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-06  6:40                       ` Eli Zaretskii
2024-07-07  2:39                         ` Sean Whitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86frso70i4.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71929@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=spwhitton@spwhitton.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.