From 64c22524372450f37ae2c11c3f62a82ad18784e9 Mon Sep 17 00:00:00 2001 From: aavit Date: Fri, 18 Feb 2011 15:27:21 +0100 Subject: Fixes: missing export of gzungetc() from internal zlib Task-number: QTBUG-17278 Reviewed-by: jiang --- src/3rdparty/zlib/zlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v0.12 From 6e23fb69e441871829765ff512e90fed17b6798d Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 22 Feb 2011 15:49:34 +0100 Subject: Keep reference count for cached font engines in QTextEngine So that if these font engines are deallocated elsewhere (by QFontCache for instance), we can still access them in QTextEngine. Task-number: QTBUG-17603 Reviewed-by: Eskil --- src/gui/text/qtextengine.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 415fa4b..d2e8291 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,9 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix scaledEngine = font.d->engineForScript(script); } feCache.prevFontEngine = engine; + engine->ref.ref(); feCache.prevScaledFontEngine = scaledEngine; + scaledEngine->ref.ref(); feCache.prevScript = script; feCache.prevPosition = si.position; feCache.prevLength = length(&si); @@ -1835,6 +1849,7 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix else { engine = font.d->engineForScript(script); feCache.prevFontEngine = engine; + engine->ref.ref(); feCache.prevScript = script; feCache.prevPosition = -1; feCache.prevLength = -1; -- cgit v0.12 From 244620438700464a862ceab7c881974a5b1d1fea Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 23 Feb 2011 12:07:10 +0100 Subject: Check engine existence before increasing reference count Reviewed-by: TrustMe --- src/gui/text/qtextengine.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index d2e8291..a63fdbf 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1836,9 +1836,11 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix scaledEngine = font.d->engineForScript(script); } feCache.prevFontEngine = engine; - engine->ref.ref(); + if (engine) + engine->ref.ref(); feCache.prevScaledFontEngine = scaledEngine; - scaledEngine->ref.ref(); + if (scaledEngine) + scaledEngine->ref.ref(); feCache.prevScript = script; feCache.prevPosition = si.position; feCache.prevLength = length(&si); @@ -1849,7 +1851,8 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix else { engine = font.d->engineForScript(script); feCache.prevFontEngine = engine; - engine->ref.ref(); + if (engine) + engine->ref.ref(); feCache.prevScript = script; feCache.prevPosition = -1; feCache.prevLength = -1; -- cgit v0.12