diff options
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 11 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 9 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60_p.h | 4 |
3 files changed, 19 insertions, 5 deletions
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 058041b..fe90010 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -126,8 +126,13 @@ QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() } QFontDatabaseS60StoreImplementation::~QFontDatabaseS60StoreImplementation() { - qDeleteAll(m_extensions); - // TODO m_store cleanup removed because it was crashing + typedef QHash<QString, const QFontEngineS60Extensions *>::iterator iterator; + for (iterator p = m_extensions.begin(); p != m_extensions.end(); ++p) { + m_store->ReleaseFont((*p)->fontOwner()); + delete *p; + } + + delete m_store; m_heap->Close(); } @@ -140,7 +145,7 @@ const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(c const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, spec); Q_ASSERT(err == KErrNone && font); CBitmapFont *bitmapFont = static_cast<CBitmapFont*>(font); - m_extensions.insert(typeface, new QFontEngineS60Extensions(bitmapFont->OpenFont())); + m_extensions.insert(typeface, new QFontEngineS60Extensions(font, bitmapFont->OpenFont())); } return m_extensions.value(typeface); } diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index eba21e8..ed6b1c1 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -54,10 +54,11 @@ QT_BEGIN_NAMESPACE -QFontEngineS60Extensions::QFontEngineS60Extensions(COpenFont *font) +QFontEngineS60Extensions::QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font) : m_font(font) , m_cmap(0) , m_symbolCMap(false) + , m_fontOwner(fontOwner) { TAny *shapingExtension = NULL; m_font->ExtendedInterface(KUidOpenFontShapingExtension, shapingExtension); @@ -109,6 +110,12 @@ QPainterPath QFontEngineS60Extensions::glyphOutline(glyph_t glyph) const return result; } +CFont *QFontEngineS60Extensions::fontOwner() const +{ + return m_fontOwner; +} + + // duplicated from qfontengine_xyz.cpp static inline unsigned int getChar(const QChar *str, int &i, const int len) { diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index 0c1be8c..bbbc3d6 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -69,11 +69,12 @@ QT_BEGIN_NAMESPACE class QFontEngineS60Extensions { public: - QFontEngineS60Extensions(COpenFont *font); + QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font); QByteArray getSfntTable(uint tag) const; const unsigned char *cmap() const; QPainterPath glyphOutline(glyph_t glyph) const; + CFont *fontOwner() const; private: COpenFont *m_font; @@ -82,6 +83,7 @@ private: mutable const unsigned char *m_cmap; mutable bool m_symbolCMap; mutable QByteArray m_cmapTable; + CFont* m_fontOwner; }; class QFontEngineS60 : public QFontEngine |