path: root/src/gui/text/qfontengine_ft_p.h
diff options
authorRobin Burchell <>2013-11-13 14:54:49 +0100
committerThe Qt Project <>2013-11-20 19:25:56 +0100
commit52ba7b1ffcb90772dc97b3e9a34beee5781ed2d7 (patch)
tree7c710ebbd3896f508a4d9fb2777c6696f363b1e0 /src/gui/text/qfontengine_ft_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 <> Change-Id: I7b91384251593730124323a74737d41333a05f59 Reviewed-by: Konstantin Ritt <> Reviewed-by: Eskil Abrahamsen Blomfeldt <>
Diffstat (limited to 'src/gui/text/qfontengine_ft_p.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index e64fec2f27..7df66b9678 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -114,9 +114,11 @@ public:
friend class QFontEngineFT;
+ friend class QtFreetypeData;
friend struct QScopedPointerDeleter<QFreetypeFace>;
QFreetypeFace() : _lock(QMutex::Recursive) {}
~QFreetypeFace() {}
+ void cleanup();
QAtomicInt ref;
QMutex _lock;
QByteArray fontData;