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
For Gerrit Dashboard: QTBUG-97995 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
381031,4 | Fix assert in QFontComboBox when setting empty font | dev | qt/qtbase | Status: MERGED | +2 | 0 |
381037,3 | Properly fix QFontDatabase test on Freetype | dev | qt/qtbase | Status: MERGED | +2 | 0 |
381148,4 | Fix deserializing Qt 5.x fonts through QDataStream | dev | qt/qtbase | Status: MERGED | +2 | 0 |
381986,2 | Fix deserializing Qt 5.x fonts through QDataStream | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
382129,2 | Fix assert in QFontComboBox when setting empty font | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
382183,2 | Properly fix QFontDatabase test on Freetype | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |