[Development] QPointer issue
Matt Broadstone
mbroadst at gmail.com
Wed Aug 5 20:35:40 CEST 2015
On Wed, Aug 5, 2015 at 2:27 PM, Denis Shienkov <denis.shienkov at gmail.com>
wrote:
> Hi all,
>
> seems that QPointer::clear() does not work as expected (for me).
>
> E.g. I assume that QPointer:clear() deletes the internal object ... but
> this not happens..
>
> So, what is way to delete an object (1 or 2)?
>
> QPointer<QObject> p = new QObject();
>
> 1) delete p;
> 2) delete p.data();
>
> BR,
> Denis
>
>
IIRC QPointer is just a guarded pointer, meaning you should use it to track
the lifetime of the wrapped pointer but it doesn't actually assume
ownership of the object. Therefore, this is working as expected.
Cheers,
Matt
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150805/b6ceb4bb/attachment.html>
More information about the Development
mailing list