That's why reference counting was invented, and the problem is that it's not used by HBQT.
Brgds, Viktor On 2010 Apr 12, at 01:52, Pritpal Bedi wrote: > > > francesco perillo wrote: >> >> I have yet another proposal: >> in QGC_POINTER_* a new member should be added, call it "fingerprint". >> > > Let me _repeat_ again: > > Problem is not with functioning of the objects, > that is working perfect. It lies when object is _destructed_ > by Qt and when Harbour tries to _free_ the pointer. > > This is the scenario we should base our findings... > > oWnd contains oPushButton, oMenu's and lot other controls - comples > parent child hirarchy. Now suppose oWnd goes out of scope, Harbour > schedules garbage collection and it is not know in what order it will > release the variables. Assume, oWidget is released first which contains > many others. Our destructor will be called which in turn will issue > delete ( QWidget * ) p->ph . The request will reach Qt GC ( they may > call is > with another name ) and Qt deletes oWidget and, by its way of > handellings, > Qt will also delete all childeren. The pointers held in Harbour GC of > those > children are still there to be released as per same cycle. And voila > GPF, because > those are already been freed by Qt. > > If you study hbXBP, I have implemented object destruction very > carefully. > Child first, parent next. That is why oDlg has ever to be issued > :destroy() > method which does not leave anything for GC to free them in arbitratory > fashion. > > The whole point os distability is the way we need to handle destruction. > > Hope this info may prove helpful to hit the right solution. > > > ----- > enjoy hbIDEing... > Pritpal Bedi > http://hbide.vouch.info/ > -- > View this message in context: > http://n2.nabble.com/Improve-on-hbqt-object-handling-tp4887521p4887614.html > Sent from the harbour-devel mailing list archive at Nabble.com. > _______________________________________________ > Harbour mailing list (attachment size limit: 40KB) > Harbour@harbour-project.org > http://lists.harbour-project.org/mailman/listinfo/harbour _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour