Follow my link
"An implicitly shared class has total control of its internal data. In
any member function that modify its data, it automatically detaches
before modifying the data."
http://www.kde.gr.jp/~ichi/qt-2.3.2/shclass.html

"Memory manager in qt..with Qt it is possible to emulate garbage
collection for child and parent classes that are derived from
QObject."
http://silmor.de/33


The Qt memory management is fine as long as you don't do things like
sharing objects or keeping objects around in caches. But it wouldn't
hurt Trolltech to use shared ptrs, because their parenting is a case
covered by reference counting.
I also found the following line in Qt's source code:
> pa.detach(); // Explicit sharing is stupid.
If Trolltech used shared ptrs, then there would not be a need for
explicit sharing, and their developers would not put these comments in
the code





2009/10/13 Pritpal Bedi <[email protected]>:
>
> Thank you Toe.
>
>
> Teo Fonrouge wrote:
>>
>> Even that this is not the solution to your current problem, I highly
>> suggest you to use a nice feature on QT called "guarded pointers".
>> Please check the following link:
>>
>> http://doc.trolltech.com/4.2/qpointer.html#details
>>
>> This is a nice feature that helps to check if a pointer to a QT
>> object, really is currently in use or has been released.
>>
>
> Certainly this will be useful. I will experiment with this.
>
> Quick constructor skeleton:
>
> HB_FUNC( QT_QWIDGET )
> {
>   void ** ph = ( void ** ) hb_gcAlloc( sizeof( void * ), QObject_release );
>   QPointer< QWidget > pObj = new QWidget( hbqt_par_QWidget( 1 ), (
> Qt::WindowFlags ) hb_parni( 2 ) ) ;
>   * ph = pObj;
>   hb_retptrGC( ph );
> }
>
> Is working fine. One guard is done with.
> Sadly this only operates on <QObject> derived classes.
> Please keep on posting if you find any info about other
> type of classes too, a very important matter.
>
> Regards
> Pritpal Bedi
>
> --
> View this message in context: 
> http://www.nabble.com/HBQT---HBXBP-%3A-Garbage-Collection-tp25813841p25865463.html
> Sent from the Harbour - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Harbour mailing list
> [email protected]
> http://lists.harbour-project.org/mailman/listinfo/harbour
>



-- 
Massimo Belgrano
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to