dumpcpp: properly clean up temporary metaobjects
authorJoerg Bornemann <joerg.bornemann@digia.com>
Mon, 3 Dec 2012 15:19:03 +0000 (16:19 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 4 Dec 2012 11:42:07 +0000 (12:42 +0100)
commit056d9b57cee7476cdb6e901334c9f8e3992f5105
treeea6aa4a3ceb9968e6eba2c0a5140e3d66d0b0288
parent57712fa583f22b3f6be63d98ab6bec3504e9a628
dumpcpp: properly clean up temporary metaobjects

All qax_* functions that return QMetaObject instances actually return
instances of QAxMetaObject. To make sure that ~QAxMetaObject is
called, we introduce the qax_deleteMetaObject function and call it in
the appropriate places.

The explicit call to QByteArray::detach is needed because the
affected QMetaObject/Method calls return a QByteArray that directly
holds a pointer to the QByteArrayData contained in QAxMetaObject.
Once the QAxMetaObject is destroyed, the QByteArray objects will hold
pointers to freed memory. Therefore we make a deep copy of the
QByteArray by detaching it.

Task-number: QTBUG-28325

Change-Id: I97613f12f1a30608dd5acd67d0faebb3f39cdf70
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
src/activeqt/container/qaxbase.cpp
tools/dumpcpp/main.cpp