Q: DONE of obj, class

In article <7ucd7n$ht...@eng-ser1.erg.cuhk.edu.hk>, Mr. Ryan

<neo_neo_n...@hotmail.com> wrote:
> 1)  Suppose v_my_obj_a is a pointer to an object
>     with some pointer fields
>     (which may be pointing to something allocated
>     by the object's methods)

>     Should the pointers be disposed in the DONE
>     destructor, or should it be done separately?
>     (That is, call dispose_my_own_extra_data_fields
>      before calling dispose(myobject,done) )

You can safely do that in your destructor.

> 2a)  What if this requires calling another method
>      within the object?
>      Will there be any problem if the method
>      is virtual?

No problem.

> 2b)  Actually (in one of my recent program)
>      the pointers are to other objects.

>      I called the objects' destructors
>      and a GPF happened in FREEMEM. Are they
>      related?


>      Or just another pointer mishandling?

Most likely. Try compiling your program (and the units it uses) with
-gh. This will install a debugging heap manager which will allert you
of wrong/missing disposals/freemems etc. Best use the latest snapshot
for this though (available in the development section of
<http://www.freepascal.org>, since it has been enhanced quite a bit
since the last release of the compiler.