[vtkusers] Application crashing on exit

Rupert Shute Rupert.Shute at awe.co.uk
Wed May 5 06:12:00 EDT 2004


Hi Ingo,

I did try Mathieu's suggestion, but still the same problem.
Below is a very cut-down version of the code that produces the problem. See
the comment in the destructor.

Regards
Rupert

#include <qnamespace.h>
#include <qapplication.h>
#include <qgl.h>
#include <qwidget.h>
#include <vtkQtObjectFactory.h> 
#include <stdio.h>
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include <qworkspace.h>
#include <qmainwindow.h>
#include <qscrollview.h>


//!Main application window.
class ApplicationWindow : public QMainWindow
{
  Q_OBJECT

    private:  
  vtkRenderer *ren1;
  vtkRenderWindow *renWin;  
  QWorkspace *workSpace;
  QScrollView *vtkScrollView;  
  QWidget *tmpWidget;

 public:
  ApplicationWindow(QWidget *parent=0, const char *name=0, WFlags f=0);
  ~ApplicationWindow();

  public slots:


 signals:  

};

____________________________________________________________________________
_____________________________
____________________________________________________________________________
_____________________________


#include "testVtkQt.h"

int main(int argc, char **argv) {  
  vtkQtObjectFactory::RegisterObjectFactory();      
  QApplication::setColorSpec( QApplication::CustomColor );    
  QApplication a(argc, argv);
  ApplicationWindow myMainWin(0, "myMainWin", 0);
  a.setMainWidget(&myMainWin);
  myMainWin.show();   
  a.exec();
}


//Main application window.
ApplicationWindow::ApplicationWindow(QWidget *parent, const char *name,
WFlags f)
  : QMainWindow( parent, name, f )
{  
  // Create the main GUI.
  workSpace = new QWorkspace (this, "workSpace" );
  this->setCentralWidget(workSpace);

  vtkScrollView = new QScrollView(workSpace, "vtkScrollView");
  
  vtkQtObjectFactory::SetQtBase(vtkScrollView->viewport(), NULL);

  ren1 = vtkRenderer::New();
  renWin = vtkRenderWindow::New();
  renWin->AddRenderer(ren1);
  renWin->Start();

   // Do the clever QT VTK bit.  
  tmpWidget = vtkQtObjectFactory::QtWidget(renWin);
  vtkScrollView->addChild(tmpWidget);

  renWin->Render();
}

ApplicationWindow::~ApplicationWindow()
{  
  delete tmpWidget;  // Do I really need to delete this?
  ren1->Delete();
  renWin->Delete();  
  delete vtkScrollView;
}



-----Original Message-----
From: de Boer Ingo [mailto:I.deBoer at polytec.de] 
Sent: 30 April 2004 11:20
To: Rupert Shute; vtkusers at vtk.org
Subject: EXTERNAL: RE: [vtkusers] Application crashing on exit


Sounds okay...

Did you try Mathieu's suggestion ?
Do you have a reproducable mini sample ?

greets
  Ingo

---
Dr.-Ing. Ingo H. de Boer

Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax  : ++49 7243 604 255
--
_______________________________________________________________________________

The information in this email and in any attachment(s) is commercial in confidence. If you are not the named addressee(s) or if you receive this email in error then any distribution, copying or use of this communication or the information in it is strictly prohibited.  Please notify us immediately by email at intadmin at awe.co.uk, and then delete this message from your computer.  While attachments are virus checked, AWE plc does not accept any liability in respect of any virus which is not detected.




More information about the vtkusers mailing list