unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: oslsachem <oslsachem@gmail.com>
Cc: 8562@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	[thread overview]
Message-ID: <838vtscbeu.fsf@gnu.org> (raw)
In-Reply-To: <BANLkTimG5Hmbz7kM0j5x-Cu1QORdsBDgyw@mail.gmail.com>

> Date: Fri, 27 May 2011 18:13:29 +0200
> From: oslsachem <oslsachem@gmail.com>
> Cc: 8562@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.





  reply	other threads:[~2011-05-27 17:15 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 21:55 bug#8562: Emacs 23.1 and later don't work in windows 98 oslsachem
2011-04-27  3:09 ` Eli Zaretskii
2011-05-06  1:38   ` oslsachem
2011-05-06 11:52     ` Eli Zaretskii
2011-05-06 15:28       ` Eli Zaretskii
2011-05-22 21:32       ` oslsachem
2011-05-23 13:43         ` Jason Rumney
2011-05-24 19:31           ` oslsachem
2011-05-23 17:39         ` Eli Zaretskii
2011-05-24 19:32           ` oslsachem
2011-05-24 20:37             ` Eli Zaretskii
2011-05-25  2:01               ` oslsachem
2011-05-25  4:28                 ` Eli Zaretskii
2011-05-25 10:53                   ` oslsachem
2011-05-25 16:44                     ` Eli Zaretskii
2011-05-26  1:50                       ` oslsachem
2011-05-27 14:04                         ` Eli Zaretskii
2011-05-27 17:22                           ` oslsachem
2011-05-27 18:17                             ` Eli Zaretskii
2011-05-27 16:13                         ` oslsachem
2011-05-27 17:15                           ` Eli Zaretskii [this message]
2011-05-27 18:33                             ` oslsachem
2011-05-27 20:51                               ` Eli Zaretskii
2011-05-30 15:12                                 ` oslsachem
2011-05-30 18:43                                   ` Eli Zaretskii
2011-05-31 18:16                                     ` oslsachem
2011-05-31 21:02                                       ` Eli Zaretskii
2011-05-31 21:04                                       ` Eli Zaretskii
2011-06-02 23:41                                         ` oslsachem
2011-06-03  7:10                                           ` Eli Zaretskii
2011-06-03  8:29                                           ` Eli Zaretskii
2011-06-03 20:10                                             ` oslsachem
2011-06-03 20:51                                               ` oslsachem
2011-06-03 22:52                                                 ` oslsachem
2011-06-04  7:11                                                   ` Eli Zaretskii
2011-06-05  1:58                                                     ` oslsachem
2011-06-05  3:07                                                       ` Eli Zaretskii
2011-06-05  5:48                                                         ` Eli Zaretskii
2011-06-05 22:32                                                         ` oslsachem
2011-06-07 19:25                                                           ` oslsachem
2011-06-07 20:32                                                             ` Eli Zaretskii
2011-06-08 18:11                                                               ` oslsachem
2011-06-08 20:36                                                                 ` Eli Zaretskii
2011-06-12 21:47                                                               ` oslsachem
2011-10-01 11:06                                                                 ` Eli Zaretskii
2011-10-26 23:05                                                                   ` oslsachem
2011-10-01 11:03                                                               ` Eli Zaretskii
2011-10-26 22:46                                                                 ` oslsachem
2011-10-27 14:53                                                                   ` Eli Zaretskii
     [not found]                                                                     ` <CADv-x1szHOjvVzg8xAYtZNE4iByugKeQz37SY+-dNVucioB70w@mail.gmail.com>
2011-10-28 10:21                                                                       ` Eli Zaretskii
2011-10-28 12:11                                                                         ` Eli Zaretskii
2011-10-29 22:24                                                                           ` oslsachem
2011-11-04 11:42                                                                             ` Eli Zaretskii
2011-11-04 20:59                                                                               ` oslsachem
2011-11-04 22:01                                                                                 ` Eli Zaretskii
2011-10-28 10:10                                                                   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838vtscbeu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=8562@debbugs.gnu.org \
    --cc=oslsachem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).