Skip to content

Commit

Permalink
Fix memory leak of QFontEngineBox object
Browse files Browse the repository at this point in the history
Delete QFontEngineBox object in QFontDatabase::load() if the object can not
be used.

Change-Id: Ifb055809703fb6be92f41fd56658198df30837fd
Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
  • Loading branch information
jianliang79 authored and Qt by Nokia committed Feb 6, 2012
1 parent 1bc8af9 commit effbc9e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gui/text/qfontdatabase_qpa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,12 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
req.family = *it;

fe = QFontDatabase::findFont(script, d, req, multi);
if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty())
if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) {
if (fe->ref.load() == 0)
delete fe;

fe = 0;
}
}

if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) {
Expand Down

0 comments on commit effbc9e

Please sign in to comment.