QFontDatabase: Use more explicit function name for clearing families

Avoids overloading on ::free() from stdlib.h

Change-Id: I71d7fa4012f189cf5640968ed43d530eff79989f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Tor Arne Vestbø 2022-03-25 12:18:37 +01:00
parent 4bd3080163
commit 3b6aba6598
2 changed files with 15 additions and 11 deletions

View File

@ -298,12 +298,22 @@ void QtFontFamily::ensurePopulated()
Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name));
}
void QFontDatabasePrivate::clearFamilies()
{
while (count--)
delete families[count];
::free(families);
families = nullptr;
count = 0;
// don't clear the memory fonts!
}
void QFontDatabasePrivate::invalidate()
{
QFontCache::instance()->clear();
fallbacksCache.clear();
free();
clearFamilies();
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->invalidate();
emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
}
@ -530,7 +540,7 @@ void qt_cleanupFontDatabase()
{
auto *db = QFontDatabasePrivate::instance();
db->fallbacksCache.clear();
db->free();
db->clearFamilies();
}
// used in qfont.cpp

View File

@ -221,9 +221,11 @@ public:
{ }
~QFontDatabasePrivate() {
free();
clearFamilies();
}
void clearFamilies();
enum FamilyRequestFlags {
RequestFamily = 0,
EnsureCreated,
@ -231,14 +233,6 @@ public:
};
QtFontFamily *family(const QString &f, FamilyRequestFlags flags = EnsurePopulated);
void free() {
while (count--)
delete families[count];
::free(families);
families = nullptr;
count = 0;
// don't clear the memory fonts!
}
int count;
QtFontFamily **families;