maher Posted January 28, 2015 Posted January 28, 2015 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. Quote
Administrators Farshad Mohajeri Posted January 28, 2015 Administrators Posted January 28, 2015 I can't say anything before I see your code. Please post a code sample here. It looks like that objects are freed twice. Quote
maher Posted January 28, 2015 Author Posted January 28, 2015 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. Quote
Administrators Farshad Mohajeri Posted January 28, 2015 Administrators Posted January 28, 2015 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; . 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.