Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Do we required to call qDeleteAll if the QList is of QSharedPointer?
Hetal last edited by
We have qList having raw pointers, we are replacing our raw pointers with QSharedPointer.
If we have QList<QSharedPointer<Foo>>, then do we required to call qDeleteAll on that QList?
or it will be automatically taken care by Qt? As we are getting error if we try to call qDeleteAll on list of QSharedPointer.
no you don't need to call qDeleteAll in that case, since the QSharedPointer takes care of it. If the QList is also created on the stack you don't need to delete it too.
The question is, do you need the (little) overhead of QSharedPointer at all?!