emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tool-bar changes


From: Chong Yidong
Subject: Re: Tool-bar changes
Date: Wed, 14 May 2008 15:30:50 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Stefan Monnier <address@hidden> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]