[Development] QtNetwork changes from QtDD SF 2011

Olivier Goffart olivier at woboq.com
Wed Dec 7 09:12:39 CET 2011


On Monday 05 December 2011 14:50:23 Jeff Mitchell wrote:

> QSharedPointer:
> * Use for all three (disk cache, cookie jar, qnam) so that the user can
> keep a ref around if they want (also for the static methods)

> * Make QSharedPointer be able to delete properly with a forward declaration

Not possible.  (or already possible with a custom deleter)


> * QObject::connect needs to be able to take a QSharedPointer<QObject>
> * QObject::connect needs to be able to take a QWeakPointer<QObject>

I don't understand this point: you can just pass the pointer.data() to 
QObject::connect, and QObject::connect automatically take care of 
disconnecting when the object is destroyed.

Or do you mean that one want QObject::connect to hold a reference?
I don't think it is a good idea. Just put the receiver in a 
QList<QSharedPointer> kept by the sender (or vice-versa)
Else, it is opening the pandora box of the circular references.





More information about the Development mailing list