@@ -4707,6 +4707,12 @@ typedef QHash<QFontEngine*, QGLGlyphHash*> QGLFontGlyphHash;
4707
4707
typedef QHash<quint64, QGLFontTexture*> QGLFontTexHash;
4708
4708
typedef QHash<const QGLContext*, QGLFontGlyphHash*> QGLContextHash;
4709
4709
4710
+ static inline void qt_delete_glyph_hash (QGLGlyphHash *hash)
4711
+ {
4712
+ qDeleteAll (*hash);
4713
+ delete hash;
4714
+ }
4715
+
4710
4716
class QGLGlyphCache : public QObject
4711
4717
{
4712
4718
Q_OBJECT
@@ -4747,7 +4753,7 @@ void QGLGlyphCache::fontEngineDestroyed(QObject *o)
4747
4753
if (font_cache->find (fe) != font_cache->end ()) {
4748
4754
ctx = keys.at (i);
4749
4755
QGLGlyphHash *cache = font_cache->take (fe);
4750
- delete cache;
4756
+ qt_delete_glyph_hash ( cache) ;
4751
4757
break ;
4752
4758
}
4753
4759
}
@@ -4784,7 +4790,7 @@ void QGLGlyphCache::cleanupContext(const QGLContext *ctx)
4784
4790
QList<QFontEngine *> keys = font_cache->keys ();
4785
4791
for (int i=0 ; i < keys.size (); ++i) {
4786
4792
QFontEngine *fe = keys.at (i);
4787
- delete font_cache->take (fe);
4793
+ qt_delete_glyph_hash ( font_cache->take (fe) );
4788
4794
quint64 font_key = (reinterpret_cast <quint64>(ctx) << 32 ) | reinterpret_cast <quint64>(fe);
4789
4795
QGLFontTexture *font_tex = qt_font_textures.take (font_key);
4790
4796
if (font_tex) {
@@ -4825,7 +4831,9 @@ void QGLGlyphCache::cleanCache()
4825
4831
QList<const QGLContext *> keys = qt_context_cache.keys ();
4826
4832
for (int i=0 ; i < keys.size (); ++i) {
4827
4833
QGLFontGlyphHash *font_cache = qt_context_cache.value (keys.at (i));
4828
- qDeleteAll (*font_cache);
4834
+ QGLFontGlyphHash::Iterator it = font_cache->begin ();
4835
+ for (; it != font_cache->end (); ++it)
4836
+ qt_delete_glyph_hash (it.value ());
4829
4837
font_cache->clear ();
4830
4838
}
4831
4839
qDeleteAll (qt_context_cache);
0 commit comments