summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-02-25 10:43:32 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-02-25 10:43:32 (GMT)
commitad365cf942e339271706554ac86319d99538bad9 (patch)
tree3bb9a494e9af7b7adb180b309e7b9c9233203325
parente0941463665d51dfe7f9b1adf13611be303fd841 (diff)
parent985738bcc2e690c4b02e132dce829768fab0ed76 (diff)
downloadQt-ad365cf942e339271706554ac86319d99538bad9.zip
Qt-ad365cf942e339271706554ac86319d99538bad9.tar.gz
Qt-ad365cf942e339271706554ac86319d99538bad9.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging: Check engine existence before increasing reference count Keep reference count for cached font engines in QTextEngine Fixes: missing export of gzungetc() from internal zlib
-rw-r--r--src/3rdparty/zlib/zlib.h2
-rw-r--r--src/gui/text/qtextengine.cpp18
2 files changed, 19 insertions, 1 deletions
diff --git a/src/3rdparty/zlib/zlib.h b/src/3rdparty/zlib/zlib.h
index 9e5b467..bdb9a3d 100644
--- a/src/3rdparty/zlib/zlib.h
+++ b/src/3rdparty/zlib/zlib.h
@@ -1171,7 +1171,7 @@ ZEXTERN int Q_ZEXPORT gzgetc OF((gzFile file));
or -1 in case of end of file or error.
*/
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
+ZEXTERN int Q_ZEXPORT gzungetc OF((int c, gzFile file));
/*
Push one character back onto the stream to be read again later.
Only one character of push-back is allowed. gzungetc() returns the
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 415fa4b..a63fdbf 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1385,6 +1385,15 @@ void QTextEngine::shape(int item) const
}
}
+static inline void releaseCachedFontEngine(QFontEngine *fontEngine)
+{
+ if (fontEngine) {
+ fontEngine->ref.deref();
+ if (fontEngine->cache_count == 0 && fontEngine->ref == 0)
+ delete fontEngine;
+ }
+}
+
void QTextEngine::invalidate()
{
freeMemory();
@@ -1392,6 +1401,9 @@ void QTextEngine::invalidate()
maxWidth = 0;
if (specialData)
specialData->resolvedFormatIndices.clear();
+
+ releaseCachedFontEngine(feCache.prevFontEngine);
+ releaseCachedFontEngine(feCache.prevScaledFontEngine);
feCache.reset();
}
@@ -1824,7 +1836,11 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
scaledEngine = font.d->engineForScript(script);
}
feCache.prevFontEngine = engine;
+ if (engine)
+ engine->ref.ref();
feCache.prevScaledFontEngine = scaledEngine;
+ if (scaledEngine)
+ scaledEngine->ref.ref();
feCache.prevScript = script;
feCache.prevPosition = si.position;
feCache.prevLength = length(&si);
@@ -1835,6 +1851,8 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
else {
engine = font.d->engineForScript(script);
feCache.prevFontEngine = engine;
+ if (engine)
+ engine->ref.ref();
feCache.prevScript = script;
feCache.prevPosition = -1;
feCache.prevLength = -1;