summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-11-16 21:07:26 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-27 16:06:05 +0100
commit729ca17b39551901ae4b1020b76a1b00539e116c (patch)
tree97365687ea614cf03bdf0146b29bc0614651e1ea /src
parent3e33d29a86a99c4dc068e640b23551a7a6e9ab90 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontengine.cpp7
1 files changed, 3 insertions, 4 deletions
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<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;
}