Subject: bug#17691: 24.3.91; crash closing remote frame

From: Ken Raeburn <[email-masked]>
Date: Wed, 04 Jun 2014 17:38:12 -0400

Dmitry Antipov <[email-masked]> writes:
> Can't reproduce (but I'm using Xnest on the same machine instead),
> both for trunk and for 24.3.91.
>
> Could you please try 1) Xnest instead of remote machine and 2) trunk
> instead of 24.3.91?

I've tried Xnest locally and couldn't reproduce the problem initially.

I noticed the function frame-font-cache that can give a peek at the
cache content (aside: without making a copy... and we have C code that
will crash if the data structure is altered in naughty ways??) and took
a look at what I'm getting for the two displays.

For the remote XQuartz display, the cache has:

("localhost:12.0"
 (x 1
    (#<font-spec x misc fixed ## iso8859-1 nil nil nil nil nil nil nil
		 ((user-spec . "7x14"))
		 > .
		 [#<font-entity x misc fixed ## iso8859-1 medium r semicondensed 13 75 110 60 nil> #<font-entity x misc fixed ## iso8859-1 medium r semicondensed 13 100 110 60 nil> ...a bunch more here...)
    (#<font-spec x nil 7x14 nil nil normal normal normal nil nil nil nil
		 ((:name . "7x14"))
		 > . #<font-entity x Misc Fixed ## ISO8859-1 medium r normal 14 75 110 70 nil>))
 (xft 1
      (#<font-spec xft misc fixed ## iso8859-1 nil nil nil nil nil nil nil
		   ((user-spec . "7x14"))
		   > .
		   [])
      (#<font-spec xft nil 7x14 nil nil normal normal normal nil nil nil nil
		   ((:name . "7x14"))
		   >)))

Note that the last one does indeed have nil instead of an array.

For the local display, the slots all contain (empty or non-empty) arrays:

(":0.0"
 (x 2
    (#<font-spec x nil Ubuntu\ Mono nil iso8859-1 nil nil nil nil nil nil nil
		 ((:name . "Ubuntu Mono 13"))
		 > .
		 [])
    (#<font-spec x unknown Ubuntu\ Mono nil iso10646-1 nil nil nil nil nil 100 nil
		 ((user-spec . "Ubuntu Mono 13"))
		 > .
		 [])
    (#<font-spec x unknown Ubuntu\ Mono nil iso10646-1 nil nil nil nil nil nil nil
		 ((:script . symbol))
		 > .
		 [])
    (#<font-spec x unknown Ubuntu\ Mono nil iso10646-1 nil nil nil nil nil nil nil
		 ((user-spec . "Ubuntu Mono 13"))
		 > .
		 []))
 (xft 2
      (#<font-spec xft unknown Ubuntu\ Mono nil iso10646-1 nil nil nil nil nil 100 nil
		   ((user-spec . "Ubuntu Mono 13"))
		   > .
		   [#<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 normal italic normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-RI.ttf" . 0)
				   (user-spec . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 bold normal normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf" . 0)
				   (user-spec . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 normal normal normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf" . 0)
				   (user-spec . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 bold italic normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-BI.ttf" . 0)
				   (user-spec . "Ubuntu Mono 13"))
				  >])
      (#<font-spec xft unknown Ubuntu\ Mono nil iso10646-1 nil nil nil nil nil nil nil
		   ((:script . symbol))
		   > .
		   [#<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 bold italic normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-BI.ttf" . 0)
				   (:script . symbol))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 normal italic normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-RI.ttf" . 0)
				   (:script . symbol))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 bold normal normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf" . 0)
				   (:script . symbol))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 normal normal normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf" . 0)
				   (:script . symbol))
				  >])
      (#<font-spec xft unknown Ubuntu\ Mono nil iso10646-1 nil nil nil nil nil nil nil
		   ((user-spec . "Ubuntu Mono 13"))
		   > .
		   [#<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 normal italic normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-RI.ttf" . 0)
				   (user-spec . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 bold normal normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf" . 0)
				   (user-spec . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 normal normal normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf" . 0)
				   (user-spec . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 bold italic normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-BI.ttf" . 0)
				   (user-spec . "Ubuntu Mono 13"))
				  >])
      (#<font-spec xft nil Ubuntu\ Mono nil iso8859-1 nil nil nil nil nil nil nil
		   ((:name . "Ubuntu Mono 13"))
		   > .
		   [#<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 normal italic normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-RI.ttf" . 0)
				   (:name . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 bold normal normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf" . 0)
				   (:name . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 normal normal normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf" . 0)
				   (:name . "Ubuntu Mono 13"))
				  > #<font-entity xft unknown Ubuntu\ Mono nil iso10646-1 bold italic normal 0 nil 100 0
				  ((:font-entity "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-BI.ttf" . 0)
				   (:name . "Ubuntu Mono 13"))
				  >])))

I noticed something I'd forgotten -- on the Mac, I have an old X
resources file setting "Emacs*font: 7x14", which is different from the
local desktop environment. If I run Xnest, and load one X resource:

  $ xrdb -load 
  Emacs*font: 7x14
  ^D
  $

and then pull up a remote frame and look at its cache, I do see some
7x14 entries under "x" that look okay, but under "xft", the last one
appears to have nil again:

 (xft 1
      (#<font-spec xft misc fixed ## iso8859-1 nil nil nil nil nil 110 nil
		   ((user-spec . "7x14"))
		   > .
		   [])
      (#<font-spec xft misc fixed ## iso10646-1 nil nil nil nil nil nil nil
		   ((:script . symbol))
		   > .
		   [])
      (#<font-spec xft misc fixed ## iso8859-1 nil nil nil nil nil nil nil
		   ((user-spec . "7x14"))
		   > .
		   [])
      (#<font-spec xft nil 7x14 nil nil normal normal normal nil nil nil nil
		   ((:name . "7x14"))
		   >)))

And when the Xnest connection went away, so did the Emacs process. So,
yeah, now I can reproduce it with Xnest...

Ken