Subject: bug#1337: crash on going into non-existing dir with find-file

From: YAMAMOTO Mitsuharu <[email-masked]>
Date: Sat, 15 Nov 2008 12:05:16 +0900

>>>>> On Fri, 14 Nov 2008 18:22:31 -0800, xah lee <[email-masked]> said:

> Thanks for the reply.
> after some debugging, it turns out that problem is tabbar mode.

> Here's the steps:

> • start emacs by
> /Applications/Emacs.app/Contents/MacOS/Emacs -Q

> • evaluate the following
> (autoload 'tabbar-mode "tabbar" "Show tab bars." t)
> (tabbar-mode 1)
> presuming the file is in your load path.

> • now, dired into root dir. C-x C-f / RET

> • emacs crashes.

> The version of tabbar i'm using is:

> ;; Author: David Ponce <[email-masked]>
> ;; Maintainer: David Ponce <[email-masked]>
> ;; Created: 25 February 2003
> ;; Keywords: convenience
> ;; Revision: $Id: tabbar.el,v 1.4 2008/06/11 22:28:24 davidswelt Exp $

> (defconst tabbar-version "2.0")

> it's not part GNU emacs so prob not relevant here... but if any is  
> interested, email me and i can provide more debugging info.

Thanks.  I could reproduce it with a slightly different version of
tabbar.el.

I think the patch below will fix it.  The other terms (X11, W32) need
a similar change.  It may not happen on X11 using the above procedure,
but it has something to do with drawing with overhangs, and whether
the crash occurs or not depends on the metric of the used font.

				     YAMAMOTO Mitsuharu
				[email-masked]

Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/Attic/macterm.c,v
retrieving revision 1.214.2.31
diff -c -p -r1.214.2.31 macterm.c
*** src/macterm.c	2 Sep 2008 08:19:06 -0000	1.214.2.31
--- src/macterm.c	15 Nov 2008 02:57:28 -0000
*************** x_draw_glyph_string (s)
*** 3777,3783 ****
        xassert (s->next->img == NULL);
        x_set_glyph_string_gc (s->next);
        x_set_glyph_string_clipping (s->next);
!       x_draw_glyph_string_background (s->next, 1);
      }
  
    /* Set up S->gc, set clipping and draw S.  */
--- 3777,3786 ----
        xassert (s->next->img == NULL);
        x_set_glyph_string_gc (s->next);
        x_set_glyph_string_clipping (s->next);
!       if (s->next->first_glyph->type == STRETCH_GLYPH)
! 	x_draw_stretch_glyph_string (s->next);
!       else
! 	x_draw_glyph_string_background (s->next, 1);
      }
  
    /* Set up S->gc, set clipping and draw S.  */