When a QGraphicsScene instance is constructed it appends itself in a list stored in a private member of the single QApplication instance, and when it is deleted, it also remove itself from that list:
QGraphicsScene::~QGraphicsScene()
{
Q_D(QGraphicsScene);
// Remove this scene from qApp's global scene list.
qApp->d_func()->scene_list.removeAll(this);
...
}
When the application object is destroyed, the inherited base class' destructors are called recursively, so, ~QApplication() calls ~QCoreApplication() which itself calls ~QObject().
The actual deletion of child objects is done in ~QObject().
Which means that at the time the scene object is destroyed, all the QApplication members are already destroyed, so ~QGraphicsScene() crashes when it tries to access the list.
new QGraphicsScene( &app );supposed to do? - Bart