Skip to content

Commit 06b7166

Browse files
Fix crash in QFont::exactMatch() with different family counts
This amends d8602ce. This change prepared for removing the singular family from the QFontDef, making the families list the only way to store family names. Before this, there was some intricate logic here to support when both family and families were set. The idea was to make it possible to match a QFont where family was set to a QFont where a single family had been added to families. For all other cases where the families lists had different lengths, we would return false. Since this was no longer needed, the code was removed, but it also accidentally introduced a crash when the sizes of the two families lists were different. This simply puts back the check for different family counts and returns false if they are different like before. Pick-to: 6.5 6.8 6.9 6.10 Fixes: QTBUG-138561 Change-Id: I864c19105dc5d582a43023e71e46b1efb29cbc21 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
1 parent 0b3d7b9 commit 06b7166

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/gui/text/qfont.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ bool QFontDef::exactMatch(const QFontDef &other) const
8282
if (stretch != 0 && other.stretch != 0 && stretch != other.stretch)
8383
return false;
8484

85+
if (families.size() != other.families.size())
86+
return false;
87+
8588
QString this_family, this_foundry, other_family, other_foundry;
8689
for (int i = 0; i < families.size(); ++i) {
8790
QFontDatabasePrivate::parseFontName(families.at(i), this_foundry, this_family);

0 commit comments

Comments
 (0)