Memory leak with Small-caps QRawFont

Make sure we deallocate the scaled rawfont, when it is not used due
to a cached engine being used instead.

This fixes a major memory leak in Qt WebKit when using Small Caps in the
complex font path. The complex font path is always used for small caps
since Qt 5.1.

Task-number: QTBUG-33576

Change-Id: I500db9ae6f6576734f1a972387a1a488218a9db6
Reviewed-by: pierre.rossi@digia.com
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
This commit is contained in:
Allan Sandfeld Jensen 2013-10-10 15:36:52 +02:00 committed by The Qt Project
parent 6f65466137
commit 894f867090

View File

@ -1886,6 +1886,10 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
scaledEngine = QFontEngineMultiQPA::createMultiFontEngine(scEngine, script);
scaledEngine->ref.ref();
feCache.prevScaledFontEngine = scaledEngine;
// If scEngine is not ref'ed by scaledEngine, make sure it is deallocated and not leaked.
if (!scEngine->ref.load())
delete scEngine;
}
}
} else