Hi!

I have a GLWidget that shows a 3d scene. When I open a file with a scene in, I need to replace that GLwidget with a new GLwidget with the loaded scene. The problem is that the program spits out a lot of exceptions when I close the program. So I suppose that the widget holding the GLWidget still tries to destroy the old GLWidget when I close the program. I'll spare you the long list of messages, but it starts with ***glibc detected*** double free or corruption.
Is there any way to solve this?

This is my attempt to do this:
Qt Code:
  1. /*
  2.   canvas is the GLWidget holding the 3d scene.
  3.   */
  4. mainLayout->removeWidget ( canvas );
  5. canvas->hide ( );
  6. canvas->setParent ( NULL )
  7. delete canvas;
  8.  
  9. /*
  10.   Creates the new GLCanvas containing the new loaded scene....
  11.  
  12.   */
  13. canvas = new GLCanvas ( newScene, this );
  14. mainLayout->addWidget ( canvas );
To copy to clipboard, switch view to plain text mode 

hope I've explained the problem in a understandable way...
thanks for reading
pir