This bug is a GC bug for sure
The simplest way to see the crash is to type this in *scratch* on a sun.
(aref (compiled-function-constants (symbol-function 'x-win-init-sun)) 0)
and do "C-j". It doesn't crash if you "(aref ... 1)"
Important points
1. You need to be on a sun and on X because 'x-win-init-sun needs to be run
and a Garbage collect must happen. If you are not on a sun or not on X do:
xemacs -nw -vanilla
(unintern 'x-remap-keysyms-using-function-key-map) C-j
(garbage-collect) C-j
(aref (compiled-function-constants (symbol-function
'x-win-init-sun)) 0) C-j
2. Here is the relevant part of x-win-init-sun
(defun x-win-init-sun ()
(defun x-remap-keysyms-using-function-key-map (from-key to-key)
......
(vector (append prefix (list to-key))))))
....
(unintern 'x-remap-keysyms-using-function-key-map)
...
byte code for x-win-init-sun:
args: nil
0 constant x-remap-keysyms-using-function-key-map
1 constant <compiled-function>
args: (from-key to-key)
3. x-win-init-sun is dumped.
Theory:
(aref (compiled-function-constants (symbol-function
'x-win-init-sun)) 0) is the symbol
x-remap-keysyms-using-function-key-map which is uninterned. The
constants vector is the only reference. However this vector is in pure
space and thus is not swept on GC. Therefore there is no link to the
symbol and thus its gets GC. Thus we get boom boom.
I am not sure this what Martin actually fixed. It might well be that
the bug is just hidden.
Jan
Show replies by date