Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-28306

Mixing QCoreApplication and QWidget should assert

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.2
    • 5.0.0 Beta 2
    • Other
    • None
    • qtbase: e93a69349f3cbca12d2f084798d48f2091ae4f3f

    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

        Activity

          People

            Unassigned Unassigned
            jpnurmi J-P Nurmi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes