GNU bug report logs - #8562
Emacs 23.1 and later don't work in windows 98

Previous Next

Packages: emacs, w32;

Reported by: oslsachem <oslsachem <at> gmail.com>

Date: Tue, 26 Apr 2011 21:59:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: oslsachem <oslsachem <at> gmail.com>
Cc: 8562 <at> debbugs.gnu.org
Subject: bug#8562: Emacs 23.1 and later don't work in windows 98
Date: Fri, 27 May 2011 20:15:37 +0300
> Date: Fri, 27 May 2011 18:13:29 +0200
> From: oslsachem <oslsachem <at> gmail.com>
> Cc: 8562 <at> debbugs.gnu.org
> 
> >> Finally, if you start Emacs with "emacs -Q -xrm Emacs.fontBackend:gdi",
> >> does it also aborts in the same way, i.e. inside window_box_height?
> 
> This has made me wonder what happens in the trunk version of Emacs
> with assertions enabled.

It crashes in the same way, so it's the same problem.

> http://www.speedyshare.com/files/28671940/EmacsTrunkGDBw32font.txt

> 819	  len = GetOutlineTextMetricsW (dc, 0, NULL);
> (gdb) 
> 820	  if (len)
> (gdb) 
> 830	  if (!metrics)
> (gdb) 
> 831	    GetTextMetricsW (dc, &w32_font->metrics);

This means GetOutlineTextMetricsW failed, and we then call
GetTextMetricsW.  But we don't test its return value, and it looks
like it also fails, because the values we put into font are based on
what it returns, and they are garbage:

> (gdb) p *font
> $3 = {
>   header = {
>     size = 1075838994, 
>     next = {
>       buffer = 0x3594800, 
>       vector = 0x3594800
>     }
>   }, 
>   props = {53574682, 53574946, 55205178, 53574898, 53568634, 102720, 102528, 
>     102656, 52, 53352474, 440, 53352474, 53642494, 53352474, 55030721, 
>     55030737, 53352474, 55205298}, 
>   max_width = -1, 
>   pixel_size = 13, 
>   height = -2, 
>   space_width = -1, 
>   average_width = -1, 
>   min_width = -1, 
>   ascent = -1, 
>   descent = -1, 
>   underline_thickness = 0, 
>   underline_position = -1, 
>   vertical_centering = 0, 
>   encoding_type = 0 '\000', 
>   baseline_offset = 0, 
>   relative_compose = 0, 
>   default_ascent = -1, 
>   font_encoder = 0x0, 
>   driver = 0x14cd800, 
>   encoding_charset = -1, 
>   repertory_charset = -1
> }

So I think we found the culprit, the question is how to make this
work.  But first let's make sure the call to GetTextMetricsW indeed
fails.  Please change this code in w32font_open_internal:

  len = GetOutlineTextMetricsW (dc, 0, NULL);
  if (len)
    {
      metrics = (OUTLINETEXTMETRICW *) alloca (len);
      if (GetOutlineTextMetricsW (dc, len, metrics))
        bcopy (&metrics->otmTextMetrics, &w32_font->metrics,
               sizeof (TEXTMETRICW));
      else
        metrics = NULL;
    }

  if (!metrics)
    GetTextMetricsW (dc, &w32_font->metrics);

to say this instead:

  unsigned e;
  ...
  len = GetOutlineTextMetricsW (dc, 0, NULL);
  if (len)
    {
      metrics = (OUTLINETEXTMETRICW *) alloca (len);
      if (GetOutlineTextMetricsW (dc, len, metrics))
        bcopy (&metrics->otmTextMetrics, &w32_font->metrics,
               sizeof (TEXTMETRICW));
      else
        metrics = NULL;
    }
  else
    e = GetLastError ();

  if (!metrics)
    {
      if (!GetTextMetricsW (dc, &w32_font->metrics))
	e = GetLastError ();
    }

Then compile, step through the code again, and tell what value gets
assigned to e.

Thanks.




This bug report was last modified 13 years and 200 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.