Good day!
With Qt 4.7.3 an example below crashes at QGraphicsScene::~QGraphicsScene() call:
#include <QCoreApplication>
#include <QGraphicsScene>
int main( int argc, char* argv[] )
{
// replace this with QObject app; and no problems
QCoreApplication app( argc, argv );
new QGraphicsScene( &app );
return 0;
}
Any ideas?
UPDATE:
Bug report created.
When a
QGraphicsSceneinstance is constructed it appends itself in a list stored in a private member of the singleQApplicationinstance, and when it is deleted, it also remove itself from that list: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
QApplicationmembers are already destroyed, so~QGraphicsScene()crashes when it tries to access the list.