Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.5.1
-
None
-
bedf0367ac580a2e73712be2f4207bb6af9f0226
Description
The following code crashes consistently, changing the QObject * to a QString, or int, works perfectly, and it's not like that it deletes the pointer because the qDebug() after the code shows that the keys are either empty or pointing to random memory, and the "this" destructor is not caller either.
QMap<QString, QObject *> mapping; mapping.insert("Seven", this); mapping.insert("Eleven", this); mapping.insert("Forty", this); qDebug() << mapping; QVariant variant = QVariant::fromValue(mapping); if (variant.canConvert<QVariantHash>()) { QAssociativeIterable iterable = variant.value<QAssociativeIterable>(); // Can use iterators: QAssociativeIterable::const_iterator it = iterable.begin(); const QAssociativeIterable::const_iterator end = iterable.end(); for ( ; it != end; ++it) { qDebug() << it.key() << it.value(); } } qDebug() << mapping;