trichview.com

trichview.support




Re: table and Access violation


Return to index


Author

Message

Bruno C.

Posted: 07/01/2003 9:28:52


"Sergey Tkachenko" a exprime avec precision :

>>

>> I find where exactly I have the crash :

>>

> But after this change a memory leak is possible.

> It's very strange that you have problem here - if there is a bug here, any

> RichView program must crash when loading table. But this does not happens.

>

> Try to return the original code and set a breakpoint in TRVTableSW.Destroy.

> Is it called once or twice for one table?


it called once for one table but if i understand your code,

procedure TD.Loaded;

begin

  inherited;

  dec(FCellCount);

  if FCellCount=0 then

    FRVTableSW.Free;

end; // HERE self (the TD object) does not exists because

TRVTableSW.Destroy destroy it when FCellCount=0 ? in Delphi, an object

can't destroy itself.


constructor TRVTableSW.Create(AOwner: TComponent);

begin

  inherited Create(AOwner);

  FTD := TD.Create(nil);

  FTD.FRVTableSW := Self;

end;


destructor TRVTableSW.Destroy;

begin

  FTD.Free;

  inherited Destroy;

end;



--

Bruno





Powered by ABC Amber Outlook Express Converter