Details
-
Bug
-
Resolution: Incomplete
-
P1: Critical
-
None
-
5.15.0
-
None
-
OS: Windows 10 Pro 64-bit
Qt 5.15.0 (latest version)
Compiler: Visual Studio 2019 compiler 64-bit, Community edition
Executed from Qt Creator in Debug mode.
Description
I'm trying to port a PyQt program to Qt (C++) and found out that QTextBrowser crashes when displaying certain glyphs.
Here's the original PyQt test program (works with PyQt 5.9.6:
from qtpy import QtWidgets app = QtWidgets.QApplication() w = QtWidgets.QTextBrowser() w.show() w.setText("Example: \U0001F996") # works w.setText("Example: \U000023FF") # fails with "tofu" but doesn't crash app.exec_()
Here's the ported C++ code (Qt 5.15.0):
#include <QApplication> #include <QTextBrowser> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTextBrowser w; // w.setFont(QFont("Segoe UI Emoji")); // Just for reference, this font usually provides emoji fallbacks // w.setText(QString::fromUcs4(U"Example \U0001F996")); // Unicode 10.0 emoji, works // w.setText(QString::fromUcs4(U"Example \U00000860")); // Unicode 10.0 glyph, fails with "tofu" glyph (no crash) // w.setText(QString::fromUcs4(U"Example \U000023FE")); // Unicode 9.0 adjacent glyph, works w.setText(QString::fromUcs4(U"Example \U000023FF")); // Unicode 10.0 glyph, CRASHES w.show(); return a.exec(); }
The uncommented line crashes. If I comment it and uncomment the others, the noted result happens, but there is no crash.
Notes:
- This may be related to
QTBUG-22275,QTBUG-27726andQTBUG-22275. - This may be related to font fallbacks or glyph rendering. If I add the below code, the program doesn't crash:
QFont adj_font = w.font(); adj_font.setStyleStrategy(QFont::NoFontMerging); w.setFont(adj_font);