Important: Please read the Qt Code of Conduct -

QApplication error in exec()

  • Hi all,

    I have a weird problem when my applicarion tries to execute @app.exec() //QApplication object in main.cpp@

    I'm trying to integrate an Ogre widget and a VTK widget on my application. All goes good if I use only one of them, but I get that error:

    @Unhandled exception at 0x00a1fd88 in QtApp.exe: 0xC0000005: Access violation reading location 0x0672faf0@

    I followed the error and it seems to crash on the Qt Core, when processing events in file "qapplicarion_win.cpp"
    bool QGuiEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
    if (!QEventDispatcherWin32::processEvents(flags)) //HERE CRASHES!!!!
    return false;

    if (configRequests)                        // any pending configs?
    return true;


    I'm using Qt 4.7 under Windows 7.
    Have somebody any clue?

    Thanks a lot!

  • I think you need to show some of your actual code before anyone can help you.

  • Here it goes.

    The 'main.cpp':

    int main(int argc, char *argv[])
    QApplication app(argc, argv);
    MainWindow *mainWin = new MainWindow();

    return app.exec();
    //while (true){}

    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>

    #include "VTKWidget.h"
    #include "OgreWidget.h"

    namespace Ui {
    class MainWindow;

    class MainWindow : public QMainWindow

    explicit MainWindow(QWidget parent = 0);//, QtOgre::GameLogic gameLogic = 0);

    //Class Members
    Ui::MainWindow *ui;

    VTKWidget *mVTKWidget;
    OgreWidget *mOgreWidget;

    #endif // MAINWINDOW_H@

    And the constructor of 'MainWindow' in 'MainWindow.cpp':
    @MainWindow::MainWindow(QWidget *parent):
    ui(new Ui::MainWindow)

    //Create Ogre Widget
    mOgreWidget = new OgreWidget( ui->widgetVis );
    mOgreWidget->resize(800, 600);



    //Create VTK Widget
    //vtkRenderWindow* renWin = vtkRenderWindow::New();
    mVTKWidget = new VTKWidget(this);



    I'm using the QVTKWidget from VTK source, and the Ogre widget like the defined "here":


  • It seems that the problem is in the QVTKWidget provided. Concretly in the paintEvent().

    I have overloaded the function in my class and now all is working, so the problem is in the painting...

  • I don't know anything about QVTKWidget. Perhaps VTK has a forum or mailinglist you can use for support on that?

  • [quote author="Andre" date="1295452972"]I don't know anything about QVTKWidget. Perhaps VTK has a forum or mailinglist you can use for support on that?[/quote]

    It seems more an event queue problem of Qt, but maybe it's a VTK issue.


  • Well, it could be that QVTKWidget tries to do some magic with Qt's eventloop, and that that causes the issue. But again: I really don't

Log in to reply