Tomáš Navara Tomáš Navara - 1 month ago 5
C++ Question

Why is there no deleteLater in QByteArray?

I have a

QByteArray*
pointer and I wish to delete it. I was hoping for the
deleteLater()
function which is described here and is part of
QObject
. This is because I wish to delete the array in another thread than the one where I created it in.

Why this function does not exist on child class
QByteArray
?

Answer

QByteArray doesn't inherit QObject, there is no deleteLater(), there is no thread affinity and it shouldn't really matter where you delete it, just make sure you don't end up with dangling pointers.

Comments