diff options
Diffstat (limited to 'src/gui/text/qstatictext.cpp')
-rw-r--r-- | src/gui/text/qstatictext.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 9506006..edf248a 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -445,7 +445,7 @@ namespace { const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); QStaticTextItem currentItem; - currentItem.fontEngine = ti.fontEngine; + currentItem.setFontEngine(ti.fontEngine); currentItem.font = ti.font(); currentItem.charOffset = m_chars.size(); currentItem.numChars = ti.num_chars; @@ -713,4 +713,24 @@ void QStaticTextPrivate::init() needsRelayout = false; } +QStaticTextItem::~QStaticTextItem() +{ + if (m_userData != 0 && !m_userData->ref.deref()) + delete m_userData; + if (!m_fontEngine->ref.deref()) + delete m_fontEngine; +} + +void QStaticTextItem::setFontEngine(QFontEngine *fe) +{ + if (m_fontEngine != 0) { + if (!m_fontEngine->ref.deref()) + delete m_fontEngine; + } + + m_fontEngine = fe; + if (m_fontEngine != 0) + m_fontEngine->ref.ref(); +} + QT_END_NAMESPACE |