Release font engine refcount when done using it in QTextEngine
5f2b6dd2a50275bc05ae5d7e9dd8902d6d49d9df increased refcounts for font engines in QTextEngine cache, we need to decrease them when the QTextEngine is deallocated. Task-number: QTBUG-21222 Reviewed-by: Eskil (cherry picked from commit 8935a84e18804c7ff4b7336e3cfdf1cd558eaf1c) Change-Id: I079c903d60e1bbcf78f555f8044dde69af82cf0e Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>bb10
parent
9358f7eaa4
commit
75a2b9eef2
|
|
@ -1164,6 +1164,7 @@ QTextEngine::~QTextEngine()
|
|||
if (!stackEngine)
|
||||
delete layoutData;
|
||||
delete specialData;
|
||||
resetFontEngineCache();
|
||||
}
|
||||
|
||||
const HB_CharAttributes *QTextEngine::attributes() const
|
||||
|
|
@ -1224,6 +1225,13 @@ static inline void releaseCachedFontEngine(QFontEngine *fontEngine)
|
|||
}
|
||||
}
|
||||
|
||||
void QTextEngine::resetFontEngineCache()
|
||||
{
|
||||
releaseCachedFontEngine(feCache.prevFontEngine);
|
||||
releaseCachedFontEngine(feCache.prevScaledFontEngine);
|
||||
feCache.reset();
|
||||
}
|
||||
|
||||
void QTextEngine::invalidate()
|
||||
{
|
||||
freeMemory();
|
||||
|
|
@ -1232,9 +1240,7 @@ void QTextEngine::invalidate()
|
|||
if (specialData)
|
||||
specialData->resolvedFormatIndices.clear();
|
||||
|
||||
releaseCachedFontEngine(feCache.prevFontEngine);
|
||||
releaseCachedFontEngine(feCache.prevScaledFontEngine);
|
||||
feCache.reset();
|
||||
resetFontEngineCache();
|
||||
}
|
||||
|
||||
void QTextEngine::clearLineData()
|
||||
|
|
|
|||
|
|
@ -631,6 +631,7 @@ public:
|
|||
int lineNumberForTextPosition(int pos);
|
||||
int positionAfterVisualMovement(int oldPos, QTextCursor::MoveOperation op);
|
||||
void insertionPointsForLine(int lineNum, QVector<int> &insertionPoints);
|
||||
void resetFontEngineCache();
|
||||
|
||||
private:
|
||||
void setBoundary(int strPos) const;
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ QTextLayout::~QTextLayout()
|
|||
void QTextLayout::setFont(const QFont &font)
|
||||
{
|
||||
d->fnt = font;
|
||||
d->feCache.reset();
|
||||
d->resetFontEngineCache();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -511,7 +511,7 @@ void QTextLayout::setAdditionalFormats(const QList<FormatRange> &formatList)
|
|||
}
|
||||
if (d->block.docHandle())
|
||||
d->block.docHandle()->documentChange(d->block.position(), d->block.length());
|
||||
d->feCache.reset();
|
||||
d->resetFontEngineCache();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Reference in New Issue