Fix memory leak when using small caps font
The small caps version of a font is kept as a QFontPrivate* which is manually reference counted, but we neglected to actually delete it when the reference count went to 0. [ChangeLog][Fonts] Fixed a memory leak when initializing a small caps font. Fixes: QTBUG-93068 Change-Id: Icc7fb7a59bf523da84d2e6fa026940a7d1230525 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Robert Löhning <robert.loehning@qt.io> (cherry picked from commit 11a40defff51dae2476e0da9f2b995a3a0f3bda8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
55522636e3
commit
562187fc55
@ -258,8 +258,10 @@ QFontPrivate::~QFontPrivate()
|
|||||||
if (engineData && !engineData->ref.deref())
|
if (engineData && !engineData->ref.deref())
|
||||||
delete engineData;
|
delete engineData;
|
||||||
engineData = nullptr;
|
engineData = nullptr;
|
||||||
if (scFont && scFont != this)
|
if (scFont && scFont != this) {
|
||||||
scFont->ref.deref();
|
if (!scFont->ref.deref())
|
||||||
|
delete scFont;
|
||||||
|
}
|
||||||
scFont = nullptr;
|
scFont = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,8 +662,10 @@ void QFont::detach()
|
|||||||
if (d->engineData && !d->engineData->ref.deref())
|
if (d->engineData && !d->engineData->ref.deref())
|
||||||
delete d->engineData;
|
delete d->engineData;
|
||||||
d->engineData = nullptr;
|
d->engineData = nullptr;
|
||||||
if (d->scFont && d->scFont != d.data())
|
if (d->scFont && d->scFont != d.data()) {
|
||||||
d->scFont->ref.deref();
|
if (!d->scFont->ref.deref())
|
||||||
|
delete d->scFont;
|
||||||
|
}
|
||||||
d->scFont = nullptr;
|
d->scFont = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user