From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Tool-bar changes Date: Wed, 14 May 2008 15:30:50 -0400 Message-ID: <87lk2cisyd.fsf@stupidchicken.com> References: <18457.37369.262079.668907@kahikatea.snap.net.nz> <200805040056.m440u3eS022727@sallyv1.ics.uci.edu> <874p9dn46h.fsf@stupidchicken.com> <87hcd8i7iq.fsf_-_@stupidchicken.com> <87skwmrsax.fsf@stupidchicken.com> <87lk2dsk6x.fsf@stupidchicken.com> <87hcd1h5lj.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210793499 11847 80.91.229.12 (14 May 2008 19:31:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 May 2008 19:31:39 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 14 21:32:14 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JwMht-0000Pm-Az for ged-emacs-devel@m.gmane.org; Wed, 14 May 2008 21:32:09 +0200 Original-Received: from localhost ([127.0.0.1]:38455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwMhA-0001PV-6R for ged-emacs-devel@m.gmane.org; Wed, 14 May 2008 15:31:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JwMgn-00010n-8G for emacs-devel@gnu.org; Wed, 14 May 2008 15:31:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JwMgl-0000yR-Gy for emacs-devel@gnu.org; Wed, 14 May 2008 15:31:00 -0400 Original-Received: from [199.232.76.173] (port=54130 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwMgl-0000yL-8L for emacs-devel@gnu.org; Wed, 14 May 2008 15:30:59 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]:33780) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JwMgk-00081U-Vm for emacs-devel@gnu.org; Wed, 14 May 2008 15:30:59 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id DF3544E4AC; Wed, 14 May 2008 15:30:50 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Wed, 14 May 2008 00:47:28 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:97160 Archived-At: Stefan Monnier writes: >> Looks like some of the lists in there have been garbage-collected. This >> is probably a GC bug. Does the GC code know not to reap lists that are >> stored in hash tables? > > Hmm... I'll take a look at it. The hash-table is marked as weak > specifically so that those can be GC'd (whether it's a good idea or > not, I don't know), but if they're GC'd then they should be removed > from the hash-table as well. It appears that the C variable weak_hash_tables, which points to a linked list of weak hash tables, is 0x0. I added the following debug code to fns.c: *** trunk/src/fns.c.~1.443.~ 2008-05-14 12:41:03.000000000 -0400 --- trunk/src/fns.c 2008-05-14 15:24:08.000000000 -0400 *************** *** 4770,4776 **** (table) Lisp_Object table; { ! return check_hash_table (table)->weak; } --- 4770,4792 ---- (table) Lisp_Object table; { ! Lisp_Object weak = check_hash_table (table)->weak; ! struct Lisp_Hash_Table *hash = XHASH_TABLE (table); ! if (!NILP (weak)) ! { ! int found = 0; ! struct Lisp_Hash_Table *h; ! ! for (h = weak_hash_tables; h; h = h->next_weak) ! { ! if (h == hash) ! found = 1; ! } ! if (found == 0) ! abort(); ! } ! ! return weak; } Then, doing M-: (hash-table-weakness tool-bar-find-image-cache) RET leads to an abort, with the following backtrace: #0 abort () at emacs.c:428 #1 0x081720b6 in Fhash_table_weakness (table=144383500) at fns.c:4786 #2 0x0816bea7 in Feval (form=147691741) at eval.c:2361 #3 0x0816c9cf in Ffuncall (nargs=2, args=0xbfc7ea50) at eval.c:3030 ... (gdb) p weak_hash_tables $1 = (struct Lisp_Hash_Table *) 0x0 (gdb) f 1 #1 0x081720b6 in Fhash_table_weakness (table=144383500) at fns.c:4786 4786 abort(); (gdb) p hash $2 = (struct Lisp_Hash_Table *) 0x89b1e08 (gdb) p hash->weak $3 = 137839209 (gdb) xsymbol $4 = (struct Lisp_Symbol *) 0x8374268 "key-and-value" I noticed that sweep_weak_hash_tables() removes empty weak hash tables from the linked list pointed to by weak_hash_tables. This may be related to the bug.