Hello Przemek

Thank for the corrections and insight.


Przemyslaw Czerpak-2 wrote:
> 
>> static QMessageBox* xhbqt_par_QMessageBox( int iParam )
>> {
>>    void ** ph = ( void ** ) hb_parptrGC( QMessageBox_release, iParam );
>>    return ph ? ( QMessageBox * ) ph : NULL;
>> }
> 
> Here is mistake. The last line should be changed to:
>    return ph ? ( QMessageBox * ) * ph : NULL;
> 
> 

But I cannot compile with this change.
Error reported is : cannot convert 'QMessageBox*' to 'void**' in assignment



> Very good. Please only remember that QT_QMESSAGEBOX_DESTROY is optional.
> You do not have to implement this function because destructor will be
> automatically activated when the last .prg item holding the pointer
> to QMessageBox will be released (cleared or overwritten).
> 

Yes, I know. I just kept it if incase appln wants to free it explicitly,
though in practive it will not be required.



> In some cases you may also need function DETACH which will be used for
> widgets attached to some other QT widgets so they will be released
> automatically with parent objects and should not be release by our GC.
> I.e.:
>    void xhbqt_detach_QMessageBox( PHB_ITEM pItem )
>    {
>       void ** ph = ( void ** ) hb_itemGetPtrGC( pItem, QMessageBox_release
> );
>       if( ph && *ph )
>          *ph = NULL;
>    }
> 
> In most of cases such function should be called by C code which attach
> widget to parent object but if you really need it then you can create
> .prg wrapper two:
>    HB_FUNC( QT_QMESSAGEBOX_DETACH )
>    {
>       xhbqt_detach_QMessageBox( hb_param( 1, HB_IT_POINTER ) );
>    }
> Please only remember that after detaching GC will not free the object
> automatically and it has to be freed in other way, i.e. by parent object.
> 

A good idea. I will try to implement it. But perhaps I need to know 
more how Qt destroys the child objects, I mean, its life-cycle.

Regards
Pritpal Bedi

PS :  BTW can you analyze why Qt keeps on consuming more memory?

-- 
View this message in context: 
http://www.nabble.com/HBQT---HBXBP-%3A-Garbage-Collection-tp25813841p25823139.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

Reply via email to