[QStaticText] Fix potential font engine leaking
Never assume the engine is still cached but rather delete it if we are the last consumer. Change-Id: I4e3c796d45c53f42722a437482d71e2dae14cad2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
parent
e8ba85b944
commit
d911f1dd42
@ -722,14 +722,19 @@ QStaticTextItem::~QStaticTextItem()
|
||||
{
|
||||
if (m_userData != 0 && !m_userData->ref.deref())
|
||||
delete m_userData;
|
||||
m_fontEngine->ref.deref();
|
||||
setFontEngine(0);
|
||||
}
|
||||
|
||||
void QStaticTextItem::setFontEngine(QFontEngine *fe)
|
||||
{
|
||||
if (m_fontEngine != 0)
|
||||
m_fontEngine->ref.deref();
|
||||
if (m_fontEngine == fe)
|
||||
return;
|
||||
|
||||
if (m_fontEngine != 0 && !m_fontEngine->ref.deref())
|
||||
delete m_fontEngine;
|
||||
|
||||
m_fontEngine = fe;
|
||||
|
||||
if (m_fontEngine != 0)
|
||||
m_fontEngine->ref.ref();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user