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

Crash when showing QQuickWidget if parent QWidget has no height/width set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • None
    • 5.5.0
    • Quick: Widget
    • None
    • Windows 7 64bit. Os X 10.10.5. Qt5.5 32bit.

    Description

      This widget:

      #ifndef WIDGET_H
      #define WIDGET_H
      
      #include <QtWidgets>
      #include <QtQuickWidgets/QQuickWidget>
      
      
      class Widget : public QWidget
      {
        Q_OBJECT
       public:
        explicit Widget(QWidget *parent = 0) : QWidget(parent) {
          QPushButton* button = new QPushButton();
          QVBoxLayout* layout = new QVBoxLayout();
          layout->addWidget(button);
      
        //  setFixedSize(500, 300); // uncomment to prevent crash
      
          setLayout(layout);
      
          connect(button, &QPushButton::clicked, this, &Widget::createQuickWidget);
        }
      
       public slots:
        void createQuickWidget() {
          QQuickWidget* quick_widget = new QQuickWidget();
          quick_widget->setResizeMode(QQuickWidget::SizeRootObjectToView);
          layout()->addWidget(quick_widget);
        }
      };
      
      #endif // WIDGET_H
      
      

      will crash with the following trace:

      0	QScopedPointer<QOpenGLFramebufferObjectPrivate,QScopedPointerDeleter<QOpenGLFramebufferObjectPrivate>>::data	qscopedpointer.h	135	0x561cc66a	
      1	qGetPtrHelper<QScopedPointer<QOpenGLFramebufferObjectPrivate,QScopedPointerDeleter<QOpenGLFramebufferObjectPrivate>>>	qglobal.h	983	0x561caefb	
      2	QOpenGLFramebufferObject::d_func	qopenglframebufferobject.h	54	0x561cc553	
      3	QOpenGLFramebufferObject::handle	qopenglframebufferobject.cpp	1330	0x564d9e31	
      4	QQuickWidgetPrivate::render	qquickwidget.cpp	210	0x57fe5213	
      5	QQuickWidget::showEvent	qquickwidget.cpp	1076	0x57fe42f0	
      6	QWidget::event	qwidget.cpp	8881	0x54a90283	
      7	QQuickWidget::event	qquickwidget.cpp	1170	0x57fe45ab	
      8	QApplicationPrivate::notify_helper	qapplication.cpp	3717	0x54a4548e	
      9	QApplication::notify	qapplication.cpp	3682	0x54a435f5	
      10	QCoreApplication::notifyInternal	qcoreapplication.cpp	965	0x573b6aa7	
      11	QCoreApplication::sendEvent	qcoreapplication.h	224	0x573bf2d9	
      12	QWidgetPrivate::show_helper	qwidget.cpp	7809	0x54a9a7ae	
      13	QWidget::setVisible	qwidget.cpp	8097	0x54a8be61	
      14	QWidgetPrivate::_q_showIfNotHidden	qwidget.cpp	8158	0x54a9af23	
      15	QWidget::qt_static_metacall	moc_qwidget.cpp	397	0x54a8533a	
      16	QMetaCallEvent::placeMetaCall	qobject.cpp	486	0x573ff84d	
      17	QObject::event	qobject.cpp	1247	0x573f9e06	
      18	QWidget::event	qwidget.cpp	9092	0x54a909e3	
      19	QQuickWidget::event	qquickwidget.cpp	1170	0x57fe45ab	
      20	QApplicationPrivate::notify_helper	qapplication.cpp	3717	0x54a4548e	
      21	QApplication::notify	qapplication.cpp	3682	0x54a435f5	
      22	QCoreApplication::notifyInternal	qcoreapplication.cpp	965	0x573b6aa7	
      23	QCoreApplication::sendEvent	qcoreapplication.h	224	0x573bf2d9	
      24	QCoreApplicationPrivate::sendPostedEvents	qcoreapplication.cpp	1593	0x573b7b76	
      25	QCoreApplication::sendPostedEvents	qcoreapplication.cpp	1451	0x573b5582	
      26	QWindowsGuiEventDispatcher::sendPostedEvents	qwindowsguieventdispatcher.cpp	81	0x54854341	
      27	qt_internal_proc	qeventdispatcher_win.cpp	414	0x57447290	
      28	InternalCallWinProc	USER32		0x761a62fa	
      29	UserCallWinProcCheckWow	USER32		0x761a6d3a	
      30	DispatchMessageWorker	USER32		0x761a77c4	
      31	DispatchMessageW	USER32		0x761a788a	
      32	QEventDispatcherWin32::processEvents	qeventdispatcher_win.cpp	807	0x57447dde	
      33	QWindowsGuiEventDispatcher::processEvents	qwindowsguieventdispatcher.cpp	73	0x5485426c	
      34	QEventLoop::processEvents	qeventloop.cpp	129	0x573b280c	
      35	QEventLoop::exec	qeventloop.cpp	204	0x573b2a12	
      36	QCoreApplication::exec	qcoreapplication.cpp	1229	0x573b50d2	
      37	QGuiApplication::exec	qguiapplication.cpp	1529	0x5615e4d8	
      38	QApplication::exec	qapplication.cpp	2978	0x54a41509	
      39	main	main.cpp	10	0x13d27ff	
      40	WinMain	qtmain_win.cpp	113	0x13d622d	
      41	__tmainCRTStartup	crtexe.c	618	0x13d560f	
      42	WinMainCRTStartup	crtexe.c	466	0x13d53cd	
      43	BaseThreadInitThunk	kernel32		0x7635336a	
      44	__RtlUserThreadStart	ntdll		0x77089882	
      45	_RtlUserThreadStart	ntdll		0x77089855	
      
      

      When the button on the widget is clicked.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-48059
          # Subject Branch Project Status CR V

          Activity

            People

              lagocs Laszlo Agocs
              neil Neil Williams
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes