I have declared two types of objects. One is called TPers (with data about individuals, like name, age, location...) and TEmployees. TEmployees contains among others, an array of TPers. When exiting the application I get a EInvalidPointer exception. Both classes are descendents of TObject, and contain a destructor:
which is implemented like
and
respectivelly.
If I stop using TEmployees (hence the array of TPers) everything works allright.
From what I've gathered this kind of exception are thrown usually when an attemp to destroy a non-existent object is encountered. So the problem must be that when destroying TEmployees, all of the TPers contained whithin are destroyed as well, and when the destructor of TPers tries to destroy all instances of TPers, some are inexistent so it raises this exception. There certainly is a workaround to this but I'm missing it...
Any help with this is appreciated.
Thanks,
Alex
Code:
destructor Destroy; override;
which is implemented like
Code:
destructor TPers.Destroy;
begin
inherited destroy;
end;
Code:
destructor TEmployees.Destroy;
begin
inherited destroy;
end;
If I stop using TEmployees (hence the array of TPers) everything works allright.
From what I've gathered this kind of exception are thrown usually when an attemp to destroy a non-existent object is encountered. So the problem must be that when destroying TEmployees, all of the TPers contained whithin are destroyed as well, and when the destructor of TPers tries to destroy all instances of TPers, some are inexistent so it raises this exception. There certainly is a workaround to this but I'm missing it...
Any help with this is appreciated.
Thanks,
Alex