When a QGraphicsScene instance is created, it is added to the list stored in the private member of a single QApplication instance, and when it is deleted, it is also removed from this list:
QGraphicsScene::~QGraphicsScene() { Q_D(QGraphicsScene); // Remove this scene from qApp global scene list. qApp->d_func()->scene_list.removeAll(this); ... }
When the application object is destroyed, the destructors of the inherited base class are called recursively, so ~QApplication() calls ~QCoreApplication() , which itself calls ~QObject() .
Actual deletion of child objects is done in ~QObject() .
Which means that when the scene object is destroyed, all QApplication members are already destroyed, so ~QGraphicsScene() crashes when it tries to access the list.
source share