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

QGLWidget + QTreeView crash

    XMLWordPrintable

Details

    Description

      Hi

      I'm trying to create a Qt app with QGLWidget and some other UI controls.
      It crashes after short time after start.

      Below are steps to reproduce the problem.

      Qt 5.0.1 on Mac.

      1. Open QTCreator. Create new project based on QMainWindow class.
      2. Add opengl to .pro file:

      QT       += core gui opengl
      

      3. Create simple GLWidget class inherited from QGLWidget (it does nothing)

          
      #pragma once
      
      #include <QGLWidget>
      
      class GLWidget : public QGLWidget 
      {
          Q_OBJECT
      public:
          GLWidget() {};
      };
      

      4. Do some stuff in Designer:

      • Place three vertical layouts on main window.
      • Organize them in vertical splitter.
      • Set CentralWidget layout to horizontal.
      • Place in MainWindow constructor at mainwindow.cpp code which adds GLWidget to the window:
      ui->verticalLayout_2->addWidget(new GLWidget);
      

      5. Run. OK!

      6. Drop QTreeView widget to the left layout in designer.

      7. Run again... CRASH!

              0	__pthread_kill			0x7fff83e5d212	
              1	pthread_kill			0x7fff8b77caf4	
              2	abort			0x7fff8b7c0dce	
              3	qt_message_fatal	qlogging.cpp	868	0x101711a88	
              4	QMessageLogger::fatal	qlogging.cpp	356	0x1017122ae	
              5	qt_assert_x	qglobal.cpp	1959	0x10170ba5a	
              6	QWidget::mapTo	qwidget.cpp	3866	0x10019dfb8	
              7	QFocusFramePrivate::updateSize	qfocusframe.cpp	95	0x1003b5785	
              8	QFocusFrame::eventFilter	qfocusframe.cpp	282	0x1003b6173	
              9	QCoreApplicationPrivate::sendThroughObjectEventFilters	qcoreapplication.cpp	863	0x10198103c	
              10	QApplicationPrivate::notify_helper	qapplication.cpp	3390	0x10015affb	
              11	QApplication::notify	qapplication.cpp	3359	0x10015fb49	
              12	QCoreApplication::notifyInternal	qcoreapplication.cpp	767	0x101980baf	
              13	QCoreApplication::sendSpontaneousEvent	qcoreapplication.h	206	0x10016329f	
              14	QWidgetWindow::handleResizeEvent	qwidgetwindow.cpp	448	0x1001e1ef5	
              15	QWidgetWindow::event	qwidgetwindow.cpp	160	0x1001e0e18	
              16	QApplicationPrivate::notify_helper	qapplication.cpp	3394	0x10015b025	
              17	QApplication::notify	qapplication.cpp	2825	0x10015cb3f	
              18	QCoreApplication::notifyInternal	qcoreapplication.cpp	767	0x101980baf	
              19	QCoreApplication::sendSpontaneousEvent	qcoreapplication.h	206	0x100dfc6ff	
              20	QGuiApplicationPrivate::processExposeEvent	qguiapplication.cpp	2169	0x100df8870	
              ...	<More>				
      

      This is assert in QWidget::mapTo function:

      QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const
      {
          QPoint p = pos;
          if (parent) {
              const QWidget * w = this;
              while (w != parent) {
                  Q_ASSERT_X(w, "QWidget::mapTo(const QWidget *parent, const QPoint &pos)",
                      "parent must be in parent hierarchy");
                  p = w->mapToParent(p);
                  w = w->parentWidget();
              }
          }
          return p;
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            lostman Lost Guadelenn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes