summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfont_p.h
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2013-11-13 14:54:49 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-20 19:25:56 +0100
commit52ba7b1ffcb90772dc97b3e9a34beee5781ed2d7 (patch)
tree7c710ebbd3896f508a4d9fb2777c6696f363b1e0 /src/gui/text/qfont_p.h
parente70ecc06b1e266b73f47291aa037114bd3d1baf7 (diff)
Cleanup freetype data in a thread-safe way
One less obvious part of this patch: the fontCache pointer in engineData was not safe. It isn't safe to rely on pointer addresses to verify we're cleaning up the right thing, as a sequence of malloc()/free()/malloc() can return the same pointer, and nothing was cleaning up the dangling pointer in engineData. With this, it is possible to safely drop OpenGL contexts in QtQuick under all conditions with no possibility of crashes. Done-with: Aaron Kennedy <aaron.kennedy@jollamobile.com> Change-Id: I7b91384251593730124323a74737d41333a05f59 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/gui/text/qfont_p.h')
-rw-r--r--src/gui/text/qfont_p.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 115e866f24..5b7f918e21 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -140,7 +140,7 @@ public:
~QFontEngineData();
QAtomicInt ref;
- QFontCache *fontCache;
+ const int fontCacheId;
QFontEngine *engines[QChar::ScriptCount];
@@ -206,6 +206,8 @@ public:
QFontCache();
~QFontCache();
+ int id() const { return m_id; }
+
void clear();
struct Key {
@@ -263,6 +265,7 @@ private:
uint current_timestamp;
bool fast;
int timer_id;
+ const int m_id;
};
Q_GUI_EXPORT int qt_defaultDpiX();