HI. Ok.

I do get 0000008 as an error in the AV message.
I know this musch so far. That in the create event of the control the
referenece is still there, but then when I call a function this is when I
get the AV.

The object does not seem to be being freed by the destroy event of the
component.
Its almost as iff, I can only access the FOwner variable IN the create event
and no where else.

Jeremy

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Paul Grimstrup
Sent: Tuesday, 13 November 2001 10:42
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Class Problem



If the address it was reading was something like $B48764 then the fOwner or
the object has been destroyed. If the address it was reading was $FFFFFF??
or $000000?? then it was trying to access a property or virtual method on a
nil pointer.

In the destructor of TMyComponent, I assume you are freeing the TMyClass.

You could set Compiler options to include debug .dcu files and step through
the Delphi Code.

But it sounds like you may be keeping your own reference to the TMyComponent
or TMyClass instance then using that reference after the object has been
destroyed. If TMyComponent is free'd, are you clearing all external
references? (using a FreeNotification for TMyComponent). If you are using
FreeNotification/Notification, make sure that in TMyComponent.Notification()
you are calling inherited.

Break the code into smaller statements and debug it that way:
  o := fOwner;
  ShowMessage(o.Name);
  i := o.ComponentIndex;
  ShowMessage(IntToStr(i));

If you get an AV accessing fOwner then your object has already been
destroyed.
If you get an AV accessing fOwner.Name then fOwner has already been
destroyed.
If you get an AV accessing o.ComponentIndex then you will need to step
through the Delphi code to see what's wrong.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to