Details
Description
Creating a QWidget instance in a QGuiApplication results to a descriptive error "QWidget: Cannot create a QWidget without QApplication", but doing the same thing in a QCoreApplication crashes without explanation. Would be nice to get a descriptive error message in that case too.
#include <QtWidgets> int main(int argc, char* argv[]) { QCoreApplication app(argc, argv); QWidget widget; }
Backtrace:
#0 0x00007ffff561701d in initFontUnlocked () at kernel/qguiapplication.cpp:196 #1 0x00007ffff561e88e in QGuiApplication::font () at kernel/qguiapplication.cpp:2263 #2 0x00007ffff56ac694 in QFont::QFont (this=0x60aa70) at text/qfont.cpp:675 #3 0x00007ffff6427d21 in QWidgetData::QWidgetData (this=0x60aa38) at ../../include/QtWidgets/../../src/widgets/kernel/qwidget.h:103 #4 0x00007ffff640ace0 in QWidgetPrivate::QWidgetPrivate (this=0x60a910, version=327680) at kernel/qwidget.cpp:267 #5 0x00007ffff640b4e6 in QWidget::QWidget (this=0x7fffffffdde0, parent=0x0, f=...) at kernel/qwidget.cpp:997 #6 0x00000000004009bc in main (argc=1, argv=0x7fffffffdf28) at main.cpp:6
Attachments
For Gerrit Dashboard: QTBUG-28306 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
41367,1 | QGuiApplication::font(): assert that a GUI app instance exists | master | qt/qtbase | Status: ABANDONED | -1 | 0 |
45245,1 | QGuiApplication::font(): assert that a GUI app instance exists | stable | qt/qtbase | Status: MERGED | +2 | 0 |