January 19, 2011

sasibu sasibu
Lab Rat
4 posts

QApplication error in exec()

 

Hi all,

I have a weird problem when my applicarion tries to execute

  1. 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:

  1. 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”

  1. bool QGuiEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
  2. {
  3.     if (!QEventDispatcherWin32::processEvents(flags))  //HERE CRASHES!!!!
  4.         return false;
  5.  
  6.     if (configRequests)                        // any pending configs?
  7.         qWinProcessConfigRequests();
  8.  
  9.     return true;
  10. }

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

Thanks a lot!

6 replies

January 19, 2011

Andre Andre
Robot Herder
6417 posts

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

January 19, 2011

sasibu sasibu
Lab Rat
4 posts

Here it goes.

The ‘main.cpp’:

  1. //Main
  2. int main(int argc, char *argv[])
  3. {
  4.      QApplication app(argc, argv);
  5.  MainWindow *mainWin = new MainWindow();
  6.  mainWin->show();
  7.  
  8.  return app.exec();
  9.  //while (true){}
  10. }

‘MainWindow.h’:

  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. //Qt
  5. #include <QMainWindow>
  6.  
  7. #include "VTKWidget.h"
  8. #include "OgreWidget.h"
  9.  
  10.  
  11. namespace Ui {
  12.     class MainWindow;
  13. }
  14.  
  15. class MainWindow : public QMainWindow
  16. {
  17.     Q_OBJECT
  18.  
  19. public:
  20.  explicit MainWindow(QWidget *parent = 0);//, QtOgre::GameLogic* gameLogic = 0);
  21.      ~MainWindow();
  22.  
  23. private:
  24.  //Class Members
  25.      Ui::MainWindow *ui;
  26.  
  27.  //Widgets
  28.  VTKWidget *mVTKWidget;
  29.  OgreWidget *mOgreWidget;
  30. };
  31.  
  32. #endif // MAINWINDOW_H

And the constructor of ‘MainWindow’ in ‘MainWindow.cpp’:

  1. MainWindow::MainWindow(QWidget *parent):
  2.  QMainWindow(parent),
  3.  ui(new Ui::MainWindow)
  4. {
  5.  ui->setupUi(this);
  6.  
  7.  //Create Ogre Widget
  8.  mOgreWidget = new OgreWidget( ui->widgetVis );
  9.  mOgreWidget->resize(800, 600);
  10.  
  11.  ui->verticalLayoutWidgetVis->addWidget(mOgreWidget);
  12.  ui->verticalLayoutWidgetVis->update();
  13.  
  14.  mOgreWidget->show();
  15.  
  16.  //Create VTK Widget
  17.  //vtkRenderWindow* renWin = vtkRenderWindow::New();
  18.  mVTKWidget = new VTKWidget(this);
  19.  //mVTKWidget->SetRenderWindow(renWin);
  20.  //mVTKWidget->createScene();
  21.  //mVTKWidget->show();
  22.  
  23.  ui->verticalLayoutWidgetSmallVis->addWidget(mVTKWidget);
  24.  ui->verticalLayoutWidgetSmallVis->update();
  25.  
  26. }

I’m using the QVTKWidget from VTK source, and the Ogre widget like the defined here [ogre3d.org]

Thanks

January 19, 2011

sasibu sasibu
Lab Rat
4 posts

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…

January 19, 2011

Andre Andre
Robot Herder
6417 posts

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

January 20, 2011

sasibu sasibu
Lab Rat
4 posts
Andre wrote:
I don’t know anything about QVTKWidget. Perhaps VTK has a forum or mailinglist you can use for support on that?

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

Thanks!

January 20, 2011

Andre Andre
Robot Herder
6417 posts

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

 
  ‹‹ Qt equivalent to MS UserControls      One Point of the Qt LGPL license ››

You must log in to post a reply. Not a member yet? Register here!