Details
-
Bug
-
Resolution: Incomplete
-
P1: Critical
-
5.15.15, 6.6.3
Description
Hi,
I tried to create and delete QQuickItem from C++. but I found there is memory leak when I call QuickItem deleteLater function.
You can check the simple attachment.
here is simple code show create quickitem in C++:
QQmlComponent component(m_pQMLEngine, "qrc:/Test.qml", this);
if(component.isReady()) {
m_tmpItem = qobject_cast<QQuickItem*>(component.create(m_pQMLContext));
m_tmpItem->setParentItem(m_pMainRootItem);
m_tmpItem->setX(100);
// QQmlApplicationEngine::setObjectOwnership(m_tmpItem, QQmlApplicationEngine::JavaScriptOwnership);
QQmlApplicationEngine::setObjectOwnership(m_tmpItem, QQmlApplicationEngine::CppOwnership);
QObject::connect(m_tmpItem, &QObject::destroyed, [&]()
);
} else