How to destroy activex component that is generating Delphi error?

Asked

Viewed 131 times

1

I am using an Adobe PDF Activex component (Tacropdf), it works well, it happens that when closing the form with the proper Release lines; Freeandnil(Tform); in Onclose, it still generates an error when closing, it seems to me that not release from memory the Tacropdf component because in hundreds of other forms in the application this is the only one that has this component and generates the error, when taking the component it closes normal.

I tried to give a Freeandnil (Acropdf1); but it generates error when trying to destroy.

I have tried numerous ways to destroy the form and the PDF object but without success, so I came to colleagues to see if anyone can give any idea what else I can do.

2 answers

2


1

Try to do it this way:

if(assigned(AcroPDF1)then 
  freeandNil(AcroPDF1)

or

if(AcroPDF1 = nil)then 
      freeandNil(AcroPDF1)

The Assigned tests if the component is created, if it is instantiated. It may be that the component is already lost, or in use, and when destroying the error.

  • 1

    Gabriel I had already tried these options, what I ended up doing was a POG to solve the problem for now: while (Assigned(Acropdf)) do Begin Try Acropdf.Free; Finally end; end;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.