[Qt-interest] Shared Pointers...
BRM
bm_witness at yahoo.com
Fri Dec 4 01:29:48 CET 2009
----- Original Message ----
From: Brad Howes <howes at ll.mit.edu>
> > On Dec 3, 2009, at 2:37 PM, BRM wrote:
> > So it is possible to use a QSharedPointer via Queued Signals/Slots?
>
Yes. But as the document says, although the counting mechanism is
thread-safe, access to the internal pointer is not, so just be careful.
Thanks.
I think I may have found the info I was looking for in Thiago's blog posting:
http://labs.trolltech.com/blogs/2009/08/25/count-with-me-how-many-smart-pointer-classes-does-qt-have/
A
very good description of the different pointer classes, even going into
4.6. I haven't installed 4.6 yet; but it would be great to see this
post or something based on it in the Qt documentation if it hasn't made
its way there yet.
As one of the comments says - it's an (IMO invaluable) insight into the different classes.
And
from it, I think I may really need QSharedDataPointer...I was really
not wanting to write another class though - since I really want to just
pass around QByteArrays in a safe way across the various threads
without having stuff copied.
I did a test - and converting from
using QByteArray to using QSharedPointer<QByteArray> as the
signal/slot parameters got me a lot farther along (6500 records versus
26500 records before the memory problems).
Ben
More information about the Qt-interest-old
mailing list