Jump to content

Recommended Posts

Posted

Hello,

 

I create some objects (classes) When MainModule.Create.

When I try to free and nil these objects on MainModule.destroy the app freezes and doesn't respont, any idea?

 

For example ,  I Create  a DataModule  that Containing all db components and functions.

 

 

 

 

 

 

 

 

Posted

Hello,

 

I did some debugs and I found that: if you create objects on MainModule.Create it will distroy the object automatically when the session closed and the objects

will destroy before MainModule.destroy called.

  • Administrators
Posted

If you create the objects with an Owner the owner is responsible to Free them and you should not call Free again.

MyObject.Create(Self);
.
.

procedure Module.OnDestroy(Sender: TObject);
begin
  MyObject.Free;  // Error: You are freeing the object for 2nd time!
end;

.

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...