diff options
author | Tero Toivola <ext-tero.toivola@nokia.com> | 2011-05-03 12:14:40 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-05-03 12:14:40 (GMT) |
commit | 36e01e698beb8b5703f5d68f5b2eb9494e11a571 (patch) | |
tree | 1d98ec65b1c2fc9b078d3c76a7eac10c0a3c1c49 /src | |
parent | 6db0153cd7e35e4a919a76ae2aadbf2d2510bfb7 (diff) | |
download | Qt-36e01e698beb8b5703f5d68f5b2eb9494e11a571.zip Qt-36e01e698beb8b5703f5d68f5b2eb9494e11a571.tar.gz Qt-36e01e698beb8b5703f5d68f5b2eb9494e11a571.tar.bz2 |
memory leak fix
If glyph is not found from glyphSet it is created dynamically and
in this case not deleted.
Task-number: https://projects.maemo.org/bugzilla/show_bug.cgi?id=244326
Merge-request: 1208
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index e89b508..9c90964 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1800,10 +1800,12 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr } else { glyphSet = &defaultGlyphSet; } + bool needsDelete = false; Glyph * g = glyphSet->getGlyph(glyph); if (!g) { face = lockFace(); g = loadGlyphMetrics(glyphSet, glyph); + needsDelete = true; } if (g) { @@ -1812,6 +1814,8 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr overall.width = g->width; overall.height = g->height; overall.xoff = g->advance; + if (needsDelete) + delete g; } else { int left = FLOOR(face->glyph->metrics.horiBearingX); int right = CEIL(face->glyph->metrics.horiBearingX + face->glyph->metrics.width); |