Subject: Re: bug#17524: 24.4.50; emacs_backtrace.txt

From: Eli Zaretskii <[email-masked]>
Date: Tue, 20 May 2014 23:00:29 +0300

> From: Michael Heerdegen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Tue, 20 May 2014 19:22:32 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Please try with a non-existent font pattern.
> 
> Then I see it crashing.  But it doesn't crash immediately after hitting
> C-x 5 2.  I get an "invalid font name" error message, and Emacs survives
> some more seconds and then seems to crash after a random command,
> e.g. after hitting C-SPC or <up>.

I think the problem is, like on Windows, that this recipe causes Emacs
to free the image cache of the single frame.  It doesn't crash
immediately because the assertion in unwind_create_frame on X is
different from that on Windows, and doesn't dereference the NULL
image_cache pointer.  But the real problem is that call to
x_free_frame_resources, which eventually calls free_frame_faces, which
decrements the image-cache refcount and frees the image cache, because
the refcount goes to zero.

So I think the X version needs the same change I made in w32fns.c in
revision 117131, modulo the changes to the assertions.  Can you try
that?  (There's a comment I added as part of the commit that explains
the problem in more detail.)