Hi

Pritpal Bedi wrote:
> 
> 
> This is true if the widget is created with pure .cpp code
> calling the constructors and destruction within from.
> 
> In Harbour-Qt we construct a widget with QWidget():new()
> which allocates a pointer in HMV and we destruct that pointer 
> through GC. It is only possible if we initiate destruction ourselves.
> 
> So if we destroy the top level, then the pointers created for
> its children are never get freed, or if HVM frees it, it is not there
> anymore. Though we have protection code in destructors, but 
> it seems that is not enough, we need another approach.
> 
> Now I understand that for nested widgets, like treeview, I have to
> start from the children then promoting to the parents while
> destroying. I will try it today.
> 
> 


I know this.
But at the and of the day, there are C++ pointers, no matter how
you store them in HVM system.
Qt knows nothing about HVM. Qt widgets (widget,dialog,...) are 
constructed with C++ new operator which returns C++ pointer, which you store
in  QGC_POINTER_QWidget.
Qt is working with usual C++ pointers (and some special: reference counted
.....).
In Qt internaly there is parent-child relationship.
Why are you trying to reimplement all dealocation logic, which is alredy
done in Qt.
IMHO you shuld use GC pointers only for top level widgeds.
And top level widget must be destructed only (implicitly or explicitly).
For child widgets you should use normal pointers.
Am I wrong?

BRGDS
Franček
-- 
View this message in context: 
http://old.nabble.com/SF.net-SVN%3A-harbour-project%3A-13957--trunk-harbour-tp27685058p27698671.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to