-
Bug
-
Resolution: Invalid
-
P4: Low
-
None
-
5.15.2
-
None
When clearing a QMenu, actions are only removed, not deleted. Minimal example:
QMenu m_pMenuOwner = new QMenu("Menu owner");
QMenu m_pMenuOther = new QMenu("Menu other");
while (true) {
for (quint64 j = 0; j < 10000; ++j) {
auto* pAction = new QAction("Action", m_pMenuOwner);
m_pMenuOwner->addAction(pAction);
m_pMenuOther->addAction(pAction);
}
// without this line the actions get deallocated, with it they don't
m_pMenuOwner->clear(); //
m_pMenuOther->clear();
m_pMenuOwner->clear();
}
I've attached the Qt Creator project and a gif with the memory consumption.
For Gerrit Dashboard: QTBUG-99206 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
386981,3 | Fix memory leak on QMenu::clear() | dev | qt/qtbase | Status: ABANDONED | -2 | 0 |