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?
        qWinProcessConfigRequests();
    
    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':

    @//Main
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    MainWindow *mainWin = new MainWindow();
    mainWin->show();

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

    'MainWindow.h':
    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    //Qt
    #include <QMainWindow>

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

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

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

    private:
    //Class Members
    Ui::MainWindow *ui;

    //Widgets
    VTKWidget *mVTKWidget;
    OgreWidget *mOgreWidget;
    };

    #endif // MAINWINDOW_H@

    And the constructor of 'MainWindow' in 'MainWindow.cpp':
    @MainWindow::MainWindow(QWidget *parent):
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

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

    ui->verticalLayoutWidgetVis->addWidget(mOgreWidget);
    ui->verticalLayoutWidgetVis->update();

    mOgreWidget->show();

    //Create VTK Widget
    //vtkRenderWindow* renWin = vtkRenderWindow::New();
    mVTKWidget = new VTKWidget(this);
    //mVTKWidget->SetRenderWindow(renWin);
    //mVTKWidget->createScene();
    //mVTKWidget->show();

    ui->verticalLayoutWidgetSmallVis->addWidget(mVTKWidget);
    ui->verticalLayoutWidgetSmallVis->update();

    }@

    I'm using the QVTKWidget from VTK source, and the Ogre widget like the defined "here":http://www.ogre3d.org/tikiwiki/QtOgre

    Thanks



  • 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.

    Thanks!



  • 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
 

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