GLib/GObject+C as the lingua franca?
thiago at kde.org
Wed Jul 30 22:29:45 BST 2008
>Will the refcounter be inside QObject or inside the pointer-holding
QObjects don't have an internal reference counter. So the counter has to
I'm trying to make it so that QSharedPointer supports both pointers
internal and external.
>Because in the latter case you would loose the refcount as soon as you
>just pass the pointer to a function or try to cast the pointer:
>QRefCountedPointer<A> a = new A();
This is C++, we have cast operators :-)
>QRefCountedPointer<B> = dynamic_cast<B*> a.p;
QSharedPointer<B> = a.dynamicCast<B>();
QSharedPointer<B> = qSharedPointerDynamicCast<B>(a);
In any case, if the object passes itself as pointers to other points (such
as in a signal emission or in "return this"), then the reference counting
has to be internal to the object. That's the only way to keep a
Also be careful if any object that can be reference counted holds an
object by reference counting. Eventually that may lead to cyclic
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: This is a digitally signed message part.
More information about the kde-core-devel