Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.11.2
-
-
089d54f06ff327f5212cb08fdbcb540066357dd5 (qt/qtbase/dev)
Description
It could be that I misunderstand the documentation, but for QComboBox::setItemDelegate() the documentation states:
Sets the item delegate for the popup list view. The combobox takes ownership of the delegate.
Now, I had the following code result in memory leaks:
if (const auto comboBox = qobject_cast<QComboBox *>(widget))
{ comboBox->setItemDelegate(std::make_unique<QStyledItemDelegate>().release()); }It's easily fixed of course. I can pass the comboBox variable to the constructor of the QStyledItemDelegate to serve as its parent QObject.
However, I thought I'd mention it anyway. To me it seems like the documentation is wrong about the QComboBox taking ownership of the delegate.
Regards, Arjen