summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-09-09 12:49:15 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-09-09 12:49:15 (GMT)
commitb62dc3277c4d41cc99d37c457e3a55842879e0b1 (patch)
tree15af47cf675392dc97ecf9698cfa9cf1086ba613 /src
parent5a9000c3aca05e28c4fc537f82d85d6ec4395dc5 (diff)
downloadQt-b62dc3277c4d41cc99d37c457e3a55842879e0b1.zip
Qt-b62dc3277c4d41cc99d37c457e3a55842879e0b1.tar.gz
Qt-b62dc3277c4d41cc99d37c457e3a55842879e0b1.tar.bz2
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
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp12
-rw-r--r--src/gui/text/qtextengine_p.h1
-rw-r--r--src/gui/text/qtextlayout.cpp4
3 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index cff3641..ee2eef6 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1334,6 +1334,7 @@ QTextEngine::~QTextEngine()
if (!stackEngine)
delete layoutData;
delete specialData;
+ resetFontEngineCache();
}
const HB_CharAttributes *QTextEngine::attributes() const
@@ -1394,6 +1395,13 @@ static inline void releaseCachedFontEngine(QFontEngine *fontEngine)
}
}
+void QTextEngine::resetFontEngineCache()
+{
+ releaseCachedFontEngine(feCache.prevFontEngine);
+ releaseCachedFontEngine(feCache.prevScaledFontEngine);
+ feCache.reset();
+}
+
void QTextEngine::invalidate()
{
freeMemory();
@@ -1402,9 +1410,7 @@ void QTextEngine::invalidate()
if (specialData)
specialData->resolvedFormatIndices.clear();
- releaseCachedFontEngine(feCache.prevFontEngine);
- releaseCachedFontEngine(feCache.prevScaledFontEngine);
- feCache.reset();
+ resetFontEngineCache();
}
void QTextEngine::clearLineData()
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index c920c7b..2b6db67 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -614,6 +614,7 @@ public:
QFixed leadingSpaceWidth(const QScriptLine &line);
int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos, bool cursorOnCharacter);
+ void resetFontEngineCache();
private:
void setBoundary(int strPos) const;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index d180f0e..f2d3de1 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -386,7 +386,7 @@ QTextLayout::~QTextLayout()
void QTextLayout::setFont(const QFont &font)
{
d->fnt = font;
- d->feCache.reset();
+ d->resetFontEngineCache();
}
/*!
@@ -519,7 +519,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();
}
/*!