diff options
author | Fabienne Semeria <fsemeria@nds.com> | 2013-07-10 14:36:08 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-12 07:02:24 (GMT) |
commit | eeeea5ad7acb4006ad4f2f556665eba848279ecf (patch) | |
tree | b785ce66704084792ef3eb9f97590e25aaed02fd /src/gui/text/qfontdatabase_qpa.cpp | |
parent | 6326b4e622942c701af90e992d7a58f59be41fa2 (diff) | |
download | Qt-eeeea5ad7acb4006ad4f2f556665eba848279ecf.zip Qt-eeeea5ad7acb4006ad4f2f556665eba848279ecf.tar.gz Qt-eeeea5ad7acb4006ad4f2f556665eba848279ecf.tar.bz2 |
qpa: Fix memory leak of QFontEngineBox object
Delete QFontEngineBox object in QFontDatabase::load() if the object can not
be used.
cherry-picked from qt5/qtbase effbc9edc57fd8a2e40729a76004fe4f5fafcf49
original patch from jianliang79 <jianliang79@gmail.com>
Modified to match changes in QAtomicInt API.
Change-Id: I1cf7398f582c918426a73973347efe4425100eec
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Julien Brianceau <jbrianceau@nds.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/gui/text/qfontdatabase_qpa.cpp')
-rw-r--r-- | src/gui/text/qfontdatabase_qpa.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index dca45e4..315f8f5 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -384,8 +384,12 @@ void QFontDatabase::load(const QFontPrivate *d, int script) req.family = *it; fe = QFontDatabase::findFont(script, d, req); - if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) + if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) { + if (fe->ref == 0) + delete fe; + fe = 0; + } } if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) { |