diff options
Diffstat (limited to 'src/gui/text/qtextengine.cpp')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 3137de6..8fc3176 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1907,12 +1907,17 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix font.setPixelSize((font.pixelSize() * 2) / 3); scaledEngine = font.d->engineForScript(script); } - feCache.prevFontEngine = engine; if (engine) engine->ref.ref(); - feCache.prevScaledFontEngine = scaledEngine; + if (feCache.prevFontEngine) + releaseCachedFontEngine(feCache.prevFontEngine); + feCache.prevFontEngine = engine; + if (scaledEngine) scaledEngine->ref.ref(); + if (feCache.prevScaledFontEngine) + releaseCachedFontEngine(feCache.prevScaledFontEngine); + feCache.prevScaledFontEngine = scaledEngine; feCache.prevScript = script; feCache.prevPosition = si.position; feCache.prevLength = length(&si); @@ -1922,9 +1927,11 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix engine = feCache.prevFontEngine; else { engine = font.d->engineForScript(script); - feCache.prevFontEngine = engine; if (engine) engine->ref.ref(); + if (feCache.prevFontEngine) + releaseCachedFontEngine(feCache.prevFontEngine); + feCache.prevFontEngine = engine; feCache.prevScript = script; feCache.prevPosition = -1; feCache.prevLength = -1; |