Qt Exception Triggered when passing a QMainWindow as the parent of a GLWidget



  • I'm getting the following Exception in Debug mode on Qt Creator 2.3

    !http://i.stack.imgur.com/KaAjw.jpg(Qt Exception)!

    The exception is triggered when passing the parent window into QGLWidget.

    @MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    // some initialization code
    glWidget = new GLWidget(); // glWidget = new GLWidget(this) doesn't work either
    glWidget->setParent(this); // uncommenting this line prevents the exception and Window is shown fine
    }@

    Class: MainWindow

    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QTimer>
    #include "glwidget.h"
    #include <QMainWindow>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private:
    Ui::MainWindow *ui;
    GLWidget *glWidget;

    // some opencv variables
    

    public slots:
    void timerEvent(QTimerEvent *);

    private slots:
    void initialize();
    };

    #endif // MAINWINDOW_H@

    Class: GLWidget

    @#ifndef GLWIDGET_H
    #define GLWIDGET_H

    #include <QtOpenGL/QGLWidget>

    #include <queue>

    class GLWidget : public QGLWidget
    {
    Q_OBJECT
    public:
    explicit GLWidget(QWidget *parent = 0);

    void initializeGL();
    void paintGL();
    void resizeGL(int w, int h);
    

    private:

    public slots:

    };

    #endif // GLWIDGET_H@

    Stack Trace: (Pointing to Line: 0)

    @0 image00400000 0x4039fb
    1 glutSolidTeapot glut32 0x10009fd7
    2 RtlpAllocateHeap ntdll 0x773d350f
    3 QGLContext::makeCurrent QtOpenGL4 0x6304d99d
    4 QGLWidget::paintEvent QtOpenGL4 0x63002629
    5 QWidget::event QtGui4 0x73d826
    6 RtlpCoalesceFreeBlocks ntdll 0x774074f5
    7 CSuggestFilterWorker::_RemoveKeysFromWordwheel SHELL32 0x75f985a4
    8 QGLWidget::event QtOpenGL4 0x6300b87e
    9 QApplicationPrivate::notify_helper QtGui4 0x6fb029
    10 QApplication::notify QtGui4 0x6fd88a
    11 QWidgetPrivate::repaint_sys QtGui4 0x87e873
    12 QWidgetPrivate::syncBackingStore QtGui4 0x732383
    13 QWidgetPrivate::syncBackingStore QtGui4 0x7323d1
    14 QWidget::event QtGui4 0x73db21
    15 free MSVCR90 0x71513c3a
    16 0x58b270
    17 RtlDebugFreeHeap ntdll 0x7744597c
    18 QVector<QPoint>::~QVector<QPoint> QtCore4 0xfa1ed0
    19 qWinMain QtCore4 0xfa214e
    20 image00400000 0x405738
    21 image00400000 0x404bed
    22 BaseThreadInitThunk kernel32 0x76f21194
    23 __RtlUserThreadStart ntdll 0x773db495
    24 _RtlUserThreadStart ntdll 0x773db468@

    You can see my full Disassemble log at http://stackoverflow.com/questions/8202429/qt-exception-triggered-when-passing-a-qmainwindow-as-the-parent-of-a-glwidget

    Thanks in advance.



  • Can you show the GLWidget constructor ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.