Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.2.0
-
None
-
Windows 10, Visual Studio 2019
-
-
71faedc5b4c1f95f47fba6d65b8f619602964d6f (qt/qtbase/dev) c13101b0b33f557763051953a71a29b540624036 (qt/qtbase/6.2)
Description
I get an error if I try to deserialize a QFont with Qt 6.2.0, serialized with Qt 5.15.0. I get a font with an empty family (I set the correct version on QDataStream). Also, if I set the deserialized font to a QFontComboBox, the application crashes.
The following code snippets show the error.
Serialize a QFont using Qt 5.15.0
//test write Qt 5.15.0 QFont font("Verdana"); font.setPointSize(12); qDebug() << font.family(); qDebug() << font.pointSize(); QFile file("test_font.bin"); file.open(QIODevice::WriteOnly); QDataStream ds(&file); ds << font; file.close();
output:
"Verdana"
12
Deserialize using Qt 6.2.0
//test read Qt 6.2.0 QFile file("test_font.bin"); file.open(QIODevice::ReadOnly); QDataStream ds(&file); ds.setVersion(QDataStream::Qt_5_15); QFont font; ds >> font; file.close(); qDebug() << font.family(); qDebug() << font.pointSize(); QFontComboBox* fontCB = new QFontComboBox(); fontCB->setCurrentFont(font); //crash!!
Output:
"" 12 ASSERT: "!isEmpty()" in file C:\Users\qt\work\qt\qtbase\include\QtCore\../../src/corelib/tools/qlist.h, line 570 Debug Error! Program: J:\VC2015\Qt.6.2.0\6.2.0\msvc2019_64\bin\Qt6Cored.dll Module: 6.2.0 File: C:\Users\qt\work\qt\qtbase\include\QtCore\../../src/corelib/tools/qlist.h Line: 570 ASSERT: "!isEmpty()" in file C:\Users\qt\work\qt\qtbase\include\QtCore\../../src/corelib/tools/qlist.h, line 570
Attachments
Issue Links
- resulted in
-
QTBUG-98341 Current font mismatch in QFontComboBox
- Open