Fix memory leak of QFontEngineBox object

Delete QFontEngineBox object in QFontDatabase::load() if the object can not
be used.

Change-Id: Ifb055809703fb6be92f41fd56658198df30837fd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
jian liang 2012-02-05 23:09:36 +08:00 committed by Qt by Nokia
parent 1bc8af96c9
commit effbc9edc5

View File

@ -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)) {