[Qt-interest] How to use a QObject tracking QWeakPointer (thread-)safely?
Thiago Macieira
thiago at kde.org
Wed Dec 1 23:19:48 CET 2010
On Wednesday, 1 de December de 2010 22:54:11 Stephen Kelly wrote:
> Hi,
>
> QWeakPointer QObject tracking section has some cautions about tracking
> objects in other threads. I should call data() only if I can guarantee the
> contained pointer will never be deleted by another thread.
>
> One way of providing that guarantee is to ensure that data() is only called
> if the contained QObject has affinity to the currentThread().
>
> How can I guarantee that? It seems like the only thing I can do is document
> it?
Yes. The only way to guarantee that is by construction.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101201/16716ba4/attachment.bin
More information about the Qt-interest-old
mailing list