From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71929: 30.0.60; crash in mark_image_cache Date: Fri, 05 Jul 2024 14:41:31 +0800 Message-ID: <871q4849yc.fsf@yahoo.com> References: <87jzi17uot.fsf@melete.silentflame.com> <87y16h6fm3.fsf@melete.silentflame.com> <86jzi1aeje.fsf@gnu.org> <86ikxlae3p.fsf@gnu.org> <87tth4ofvp.fsf@melete.silentflame.com> <86jzi073r8.fsf@gnu.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18550"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 71929@debbugs.gnu.org, Sean Whitton To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 05 08:42:21 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sPceD-0004f5-9Q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jul 2024 08:42:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPcds-0001Pu-CH; Fri, 05 Jul 2024 02:42:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPcdr-0001Pj-Bw for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 02:41:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPcdr-00009X-3M for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 02:41:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sPcdt-0007Nc-T0 for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 02:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jul 2024 06:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71929 X-GNU-PR-Package: emacs Original-Received: via spool by 71929-submit@debbugs.gnu.org id=B71929.172016171828359 (code B ref 71929); Fri, 05 Jul 2024 06:42:01 +0000 Original-Received: (at 71929) by debbugs.gnu.org; 5 Jul 2024 06:41:58 +0000 Original-Received: from localhost ([127.0.0.1]:43450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPcdp-0007NL-L3 for submit@debbugs.gnu.org; Fri, 05 Jul 2024 02:41:58 -0400 Original-Received: from sonic315-22.consmr.mail.ne1.yahoo.com ([66.163.190.148]:42000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPcdn-0007N5-Gp for 71929@debbugs.gnu.org; Fri, 05 Jul 2024 02:41:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1720161705; bh=7dp+addgDSAN+JUBI68+t7DN4F4PBvBxvl5E1v3gE5w=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=Ym7WtINzRrTUifgEEPnRRp5GEaoqIr0ixR/YNPiyIH51FZrMHVogHN2tetO+JqGA8o6A41I+PuBFsnwTAOLJdm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sPdnvGGmUoxL3WwZeemsXZS9ox9ZGKuIM5n4_KZkAiZbXw3Qli7VQ.9LT7O8Jwx8cSE5av H3VE1a2cqk7GTEBYXLdIuLYCwEQ.XCvc6GwQQ0Xra6yHiOc_WA.2_dWUeGuvGCsmD74tnA7K_M_T jZZywTJkDJd4TtFydZLxI4qzOEb_IOFd_Ju1xVaCJksTR8C98KWcaSKh5KS6bmh0q818SUUNmszC 2.80bzYkcRG6pLTkzDtH3QWCM1eZnhX8ltyryDmdWd_2M.0YwGZyBfJQEHKiZfnF16mm4AHKUMc2 ry9R2.AO1nr01.mE39eSa6jBq9jl1R_pVJDfnKKV9dxtm.H9ifr751mJJpupEf2obvtWJi_bdmSD GhppM1bUtjgxawoQV81OS3ZjYutlBO2buczQ4L8sdUgkbdQibPhN8lN9HPyvl4z02XNEUdcqXTR7 HLFM1og10tpILEizi5xgZvayPEcYFavZRd3M4Z23elzzpQy1G.PZoMru6T9Mlxv_8.qq0WulWvm8 _.ThZneRWL0e1f7eI2QY_NfEdBkZ1s7cIJJUQ0K_y6 X-Sonic-MF: X-Sonic-ID: baecd26f-3b3c-4291-b21b-c04d6c9068fb Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.ne1.yahoo.com with HTTP; Fri, 5 Jul 2024 06:41:45 +0000 Original-Received: by hermes--production-sg3-7b469d9f6-6hvhq (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9762d0ad3c5a24a22c01a6b875e3fdc5; Fri, 05 Jul 2024 06:41:38 +0000 (UTC) In-Reply-To: <86jzi073r8.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 05 Jul 2024 09:27:07 +0300") X-Mailer: WebService/1.1.22464 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288409 Archived-At: Eli Zaretskii writes: >> From: Sean Whitton >> 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++; } }