Fix possible assertion when using stringToCMap() for a multi engine

If (*nglyphs < len), stringToCMap() sets *nglyphs to len and returns
false immediately; the caller then must resize the buffer and re-try.
However, QFontEngineMulti::stringToCMap() doesn't update the nglyphs value
and thus the second call would fail, too. This is quite unexpected.

Change-Id: Id2cce7b9faf7706c382fccf023e1b7affa9a10be
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
bb10
Konstantin Ritt 2012-11-16 21:07:26 +02:00 committed by The Qt Project
parent 3e33d29a86
commit 729ca17b39
1 changed files with 3 additions and 4 deletions

View File

@ -1364,8 +1364,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
QGlyphLayout *glyphs, int *nglyphs,
QFontEngine::ShaperFlags flags) const
{
int ng = *nglyphs;
if (!engine(0)->stringToCMap(str, len, glyphs, &ng, flags))
if (!engine(0)->stringToCMap(str, len, glyphs, nglyphs, flags))
return false;
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
@ -1415,8 +1414,8 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
++glyph_pos;
}
*nglyphs = ng;
glyphs->numGlyphs = ng;
*nglyphs = glyph_pos;
glyphs->numGlyphs = glyph_pos;
return true;
}