Closed
Bug 456899
Opened 16 years ago
Closed 10 years ago
ASSERTION: forgot to short-circuit a text run with zero-sized font?: 'GetStyle()->size != 0', file gfxFT2FontBase.cpp, line 178
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: MatsPalmgren_bugz, Assigned: gbrown)
References
Details
(Keywords: assertion, testcase)
Attachments
(4 files, 4 obsolete files)
STEPS TO REPRODUCE 1. start Firefox and load the attached testcase (only occurs once, need to restart Firefox to trigger it again) ACTUAL RESULT ASSERTION: forgot to short-circuit a text run with zero-sized font?: 'GetStyle()->size != 0', file gfxPangoFonts.h, line 94
Reporter | ||
Comment 1•16 years ago
|
||
Reporter | ||
Comment 2•16 years ago
|
||
It's the GetSpaceGlyph() call here that causes it: http://hg.mozilla.org/mozilla-central/annotate/4c3dccca8505/gfx/thebes/src/gfxFont.cpp#l615 The reason we're in GetOrCreateGlyphExtents() is because NeedsGlyphExtents() is true (TEXT_NEED_BOUNDING_BOX): http://hg.mozilla.org/mozilla-central/annotate/4c3dccca8505/gfx/thebes/src/gfxFont.cpp#l519
Reporter | ||
Comment 3•16 years ago
|
||
Possible fix. Alternatively, we could move the assertion to some other place. We should fix gfxTextRun::FetchGlyphExtents() anyway since it could crash if 'extents' is null for some reason such as OOM.
Reporter | ||
Comment 4•16 years ago
|
||
Attachment #340265 -
Attachment is obsolete: true
Comment 5•14 years ago
|
||
Happens on tinderbox reliably with testcase: layout/reftests/bugs/355548-3.xml
Comment 7•13 years ago
|
||
Karl, is this bug still relevant?
Comment 8•13 years ago
|
||
Assertion still fires with the first testcase. The approach in the patch looks sensible (from quick inspection).
Summary: ASSERTION: forgot to short-circuit a text run with zero-sized font?: 'GetStyle()->size != 0', file gfxPangoFonts.h, line 94 → ASSERTION: forgot to short-circuit a text run with zero-sized font?: 'GetStyle()->size != 0', file gfxFT2FontBase.cpp, line 178
Assignee | ||
Updated•10 years ago
|
Assignee | ||
Comment 9•10 years ago
|
||
:mats -- I am trying to resolve bug 1019178, a reftest that hits this assertion on Android. Un-bitrotting your wip patch resolves that issue, and also allows us to remove an expected assertion notation from a mochitest. Try run looks promising: https://tbpl.mozilla.org/?tree=Try&rev=9f12ffd3922e (I had not updated the mochitest yet in that push.) Is there more to do here, or can your patch be reviewed and checked in?
Attachment #8443498 -
Flags: feedback?(mats)
Reporter | ||
Comment 10•10 years ago
|
||
Comment on attachment 8443498 [details] [diff] [review] un-bitrotted "wip" patch I don't remember why I didn't submit it for review. I suspect I wanted to investigate some detail first... Anyway, looking at the code again I think this should work; although in FetchGlyphExtents it would probably be better to just do the same "GetStyle()->size == 0" early return instead of looping without doing anything (AFAICT). (and please wrap the condition with MOZ_UNLIKELY in both places) (I think I might have added the 'extents' null-check there partly b/c GetOrCreateGlyphExtents could OOM back then. I think that allocation is now infallible.) I suggest you ask Jonathan Kew <jfkthame@gmail.com> for review.
Attachment #8443498 -
Flags: feedback?(mats) → feedback+
Assignee | ||
Comment 11•10 years ago
|
||
(In reply to Mats Palmgren (:mats) from comment #10) Thanks Mats. > although in FetchGlyphExtents it would probably be better > to just do the same "GetStyle()->size == 0" early return > instead of looping without doing anything (AFAICT). GetStyle() applies to a gfxFont instance, and we are looping through potentially different fonts in FetchGlyphExtents, so I think I cannot do an early return, and your original extents null-check is still the best approach.
Reporter | ||
Comment 12•10 years ago
|
||
Ah, OK, it makes sense as is then. Just add MOZ_UNLIKELY in both places.
Assignee | ||
Comment 13•10 years ago
|
||
This is very nearly the same as :mats original patch from years past, updated for bitrot (see Comments 9 - 12) and some minor changes to assertion expectations for a couple of tests. New try run at https://tbpl.mozilla.org/?tree=Try&rev=fdf6a9484403.
Attachment #340266 -
Attachment is obsolete: true
Attachment #8443498 -
Attachment is obsolete: true
Attachment #8443765 -
Flags: review?(jfkthame)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → gbrown
Comment 14•10 years ago
|
||
Comment on attachment 8443765 [details] [diff] [review] :mats patch resurrected + update test assertion expectations Review of attachment 8443765 [details] [diff] [review]: ----------------------------------------------------------------- I don't much like changing GetOrCreateGlyphExtents such that it may return null; this seems unexpected (now that the memory allocation it may need to do is infallible), and hence perhaps a footgun for the future. How about just adding if (MOZ_UNLIKELY(font->GetStyle()->size == 0)) { continue; } early in the FetchGlyphExtents() loop, to immediately short-circuit there?
Assignee | ||
Comment 15•10 years ago
|
||
Updated as suggested. There is another caller of GetOrCreateGlyphExtents, so I had to add a guard there too (otherwise, some tests still hit the assertion).
Attachment #8443765 -
Attachment is obsolete: true
Attachment #8443765 -
Flags: review?(jfkthame)
Attachment #8444014 -
Flags: review?(jfkthame)
Assignee | ||
Comment 16•10 years ago
|
||
(In reply to Jonathan Kew (:jfkthame) from comment #14) > null; this seems unexpected (now that the memory allocation it may need to > do is infallible) Out of curiosity, how is GetOrCreateGlyphExtents infallible? Can it not OOM at http://hg.mozilla.org/mozilla-central/annotate/366b5c0c02d3/gfx/thebes/gfxFont.cpp#l4337 ?
Comment 17•10 years ago
|
||
It can OOM, yes. "Infallible" here meaning that if it can't allocate the memory it needs, it'll abort. So callers shouldn't have to worry about it returning a bogus result (such as an unexpectedly null pointer) - if it returns at all, the object it returns is safe to use.
Comment 18•10 years ago
|
||
Comment on attachment 8444014 [details] [diff] [review] :mats patch resurrected + update test assertion expectations Review of attachment 8444014 [details] [diff] [review]: ----------------------------------------------------------------- Hmmm. On reflection, I sort of think that assertion should move -- into GetOrCreateGlyphExtents, maybe -- so that it's applicable on all platforms. But that could be a separate followup (if indeed it makes sense). For now, this should be fine.
Attachment #8444014 -
Flags: review?(jfkthame) → review+
Assignee | ||
Comment 19•10 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=90de02bf41d5 https://hg.mozilla.org/integration/mozilla-inbound/rev/9f8c69149b7e
https://hg.mozilla.org/mozilla-central/rev/9f8c69149b7e
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in
before you can comment on or make changes to this bug.
Description
•