[Development] Undeprecating QPointer

Thiago Macieira thiago.macieira at intel.com
Fri Mar 2 10:27:56 CET 2012


Hello

QPointer was ported to a QWeakPointer backend and deprecated early in Qt 5 
history. However, QPointer is used throughout our code and, I can expect, in 
user code too. Replacing it with QWeakPointer is just monkey work, adding 
.data() everywhere and buying us no better safety (because no one will bother 
to verify that the pointer could be got at that point). After the port to 
QWeakPointer, QPointer is no longer slow either.

I'd like to suggest we un-deprecate it and bring it back to full status. At 
the same time, I'd like to suggest we discourage using QWeakPointer for 
tracking QObjects, instead leaving it to its original purpose of being the 
weak reference counterpart to QSharedPointer.

I'm not going as far as suggesting we deprecate the QWeakPointer(QObject*) 
constructor yet. I need to do a bit of research on how a future QSharedPointer 
& QWeakPointer with full "enable_shared_from_this" and QObject tracking would 
look like.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120302/d89a40d7/attachment.sig>


More information about the Development mailing list