From 729ca17b39551901ae4b1020b76a1b00539e116c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 16 Nov 2012 21:07:26 +0200 Subject: 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 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 400ce8366f..0f0ad290fd 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -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(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; } -- cgit v1.2.3