merlvingian
22nd November 2006, 17:37
Looking for confirmation on this attribute and garbage collection. If I do the following:
QWidget *Qw = new QWidget();
Qw->setAttribute(Qt::WA_DeleteOnClose, true);
qDebug() << testAttribute(Qt::WA_DeleteOnClose); // paranoid confirmation
Qw->close();
// At this point I can still access Qw without any errors
qDebug() << Qw->baseSize(); // pick any access function
Now this code never crashes for me, my guess would be that garbage collection happens when time permits and the post close access is playing Russian roulette.
Is this the correct assumption?
QWidget *Qw = new QWidget();
Qw->setAttribute(Qt::WA_DeleteOnClose, true);
qDebug() << testAttribute(Qt::WA_DeleteOnClose); // paranoid confirmation
Qw->close();
// At this point I can still access Qw without any errors
qDebug() << Qw->baseSize(); // pick any access function
Now this code never crashes for me, my guess would be that garbage collection happens when time permits and the post close access is playing Russian roulette.
Is this the correct assumption?