* divide-by-zero during redisplay
@ 2008-05-26 10:43 Miles Bader
2008-05-26 10:58 ` Miles Bader
2008-05-27 1:44 ` Kenichi Handa
0 siblings, 2 replies; 3+ messages in thread
From: Miles Bader @ 2008-05-26 10:43 UTC (permalink / raw)
To: emacs-devel
In the function "xfont_open", there's this code (line 611):
int width = font->space_width, n = pcm != NULL;
for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
width += pcm->width, n++;
font->average_width = width / n;
I'm getting divide-by-zeros during redisplay, because n == 0.
Maybe this represents some degenerate condition (I'm having a hard time
reproducing it currently; I saw it happen while displaying rcirc channel
buffers), but still, it seems the code should avoid dividing by zero in
such a case.
Thanks,
-Miles
--
Mayonnaise, n. One of the sauces that serve the French in place of a state
religion.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: divide-by-zero during redisplay
2008-05-26 10:43 divide-by-zero during redisplay Miles Bader
@ 2008-05-26 10:58 ` Miles Bader
2008-05-27 1:44 ` Kenichi Handa
1 sibling, 0 replies; 3+ messages in thread
From: Miles Bader @ 2008-05-26 10:58 UTC (permalink / raw)
To: emacs-devel
Ok, the problem also occurs while displaying the HELLO buffer.
Here's some debugging prints in case it's useful:
0x081d9bc5 in xfont_open (f=0x8730600, entity=187898252, pixel_size=12) at /usr/local/src/emacs/miles/src/xfont.c:616
(gdb) p font
$1 = (struct font *) 0xb3318b0
(gdb) p *font
$2 = {
size = 1075838994,
next = 0x8875b38,
props = {138058081, 140052105, 140052105, 141259337, 183594753, 205448, 205064, 205312, 96, 0, 0, 0, 137858329, 137858329, 184390795, 184390795, 137858329, 138058081},
max_width = 0,
pixel_size = 12,
height = 15,
space_width = 0,
average_width = 0,
min_width = 0,
ascent = 12,
descent = 3,
underline_thickness = 0,
underline_position = 0,
vertical_centering = 0,
encoding_type = 0 '\0',
baseline_offset = 0,
relative_compose = 0,
default_ascent = 0,
font_encoder = 0x0,
driver = 0x832fa80,
encoding_charset = 2,
repertory_charset = -1
}
(gdb) p pcm
$3 = (XCharStruct *) 0x0
(gdb) p props[0]
No symbol "props" in current context.
(gdb) p font->props[0]
$4 = 138058081
(gdb) pr
x
(gdb) p font->props[1]
$5 = 140052105
(gdb) pr
wenquanyi
(gdb) p font->props[2]
$6 = 140052105
(gdb) pr
wenquanyi
(gdb) p font->props[3]
$7 = 141259337
(gdb) pr
(gdb) p font->props[4]
$8 = 183594753
(gdb) pr
gb18030\.2000-0
(gdb) p font->props[5]
$9 = 205448
(gdb) pr
25681
(gdb) p font->props[6]
$10 = 205064
(gdb) pr
25633
(gdb) p font->props[7]
$11 = 205312
(gdb) pr
25664
(gdb) p font->props[8]
$12 = 96
(gdb) pr
12
(gdb) p font->props[9]
$13 = 0
(gdb) p font->props[10]
$14 = 0
(gdb) p font->props[11]
$15 = 0
(gdb) pr
0
(gdb) p font->props[12]
$16 = 137858329
(gdb) pr
nil
(gdb) p font->props[13]
$17 = 137858329
(gdb) pr
nil
(gdb) p font->props[14]
$18 = 184390795
(gdb) pr
"-wenquanyi-wenquanyi-medium-r-normal--12-87-100-100-p-120-gb18030.2000-0"
(gdb) p font->props[15]
$19 = 184390795
(gdb) pr
"-wenquanyi-wenquanyi-medium-r-normal--12-87-100-100-p-120-gb18030.2000-0"
(gdb) p font->props[16]
$20 = 137858329
(gdb) pr
nil
(gdb) p font->props[17]
$21 = 138058081
(gdb) pr
x
(gdb) p font->props[18]
$22 = 0
(gdb)
-Miles
--
Accordion, n. An instrument in harmony with the sentiments of an assassin.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: divide-by-zero during redisplay
2008-05-26 10:43 divide-by-zero during redisplay Miles Bader
2008-05-26 10:58 ` Miles Bader
@ 2008-05-27 1:44 ` Kenichi Handa
1 sibling, 0 replies; 3+ messages in thread
From: Kenichi Handa @ 2008-05-27 1:44 UTC (permalink / raw)
To: Miles Bader; +Cc: emacs-devel
In article <buotzgl4a7a.fsf@dhapc248.dev.necel.com>, Miles Bader <miles.bader@necel.com> writes:
> In the function "xfont_open", there's this code (line 611):
> int width = font->space_width, n = pcm != NULL;
> for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
> if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
> width += pcm->width, n++;
> font->average_width = width / n;
> I'm getting divide-by-zeros during redisplay, because n == 0.
> Maybe this represents some degenerate condition (I'm having a hard time
> reproducing it currently; I saw it happen while displaying rcirc channel
> buffers), but still, it seems the code should avoid dividing by zero in
> such a case.
Right. I've just installed a fix.
---
Kenichi Handa
handa@ni.aist.go.jp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-27 1:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-26 10:43 divide-by-zero during redisplay Miles Bader
2008-05-26 10:58 ` Miles Bader
2008-05-27 1:44 ` Kenichi Handa
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.