On quarta-feira, 4 de maio de 2016 20:56:52 PDT Nikos Chantziaras wrote: > From what I can tell, QPointer does not delete the object, so that's a > no go. > > Putting the objects on the stack doesn't work either, because the Qt > object model does not support that (it will call 'delete' on the object > even if it's on the stack.)
So what are you requirements? Do you want to a container that does delete the object it has, unless the parent has already deleted it? Use a custom deleter for unique_ptr that carries a QPointer so you can tell whether it's already been deleted. Or if you want to risk private API, see QtSharedPointer::ExternalRefCountData::getAndRef(). Since it's used by inline code, it can't disappear before Qt 6. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest