This is my first post here, but I'd like to say thank you to the community because I've found solutions to my problems countless times by coming here and finding a solution in a question that had already been answered.
That being said, I'd like to get to the point. I'm working in Code Gear's Delphi 2007 IDE. I'm still rather new to working in delphi, less than 3 months to be precise, so please keep this in mind as I may be missing something basic here.
First I'd like to give a little context surrounding the problem. I'm writing a scheduling utility for executing tasks at specific times. For each available task there is 2 related delphi frames that are associated with that task. The first frame is for editing details specific to that task, and the second frame is for displaying run-time information when the tasks is running.
A list of running tasks is kept, and in a scrollbox in the utility, a list of corresponding frames for the runtime information is displayed. These runtime frames are created and destroyed as the tasks start and end. Which brings me to my problem.
I use a virtual class manager to keep a list of available display and edit frames for each task, and create them on the fly as their needed. During run time everything behaves appropriately, its when the application actually closes that I'm seeing the problem.
the program rasies an EAccessViolation exception as its closing. When I've tried to trace into the problem using the IDE, The line or action corresponding with the problem doesn't actually exist in my code. So it must be part of some clean up functionality that's being performed in the back ground.
I have narrowed it down to the code that creates the virtual class frames on the fly, because it closes fine when i have that code commented out. So this leads me to believe that I'm not performing some action related to using this type of class creation.
var
tmpCCI: TComponentClassInfExt;
tmpS: String;
tc: TComponent;
bf: TBaseactionedit;
...
begin
...
tc := tmpCCI.fComponentClass.Create(nil);
if tc is TBaseactionedit then
begin
bf := TBaseActionEdit(tc);
bf.name := tmpCCI.fComponentClass.classname+IntToStr(nameCount);
bf.Visible := False;
bf.parent := pnlActionEdit;
bf.Align := alClient;
bf.Visible := True;
end;
...
This is the excerpt of how I'm creating the frames using the virtual class manager. I'm freeing instances with FreeAndNil when they're no longer needed. I've traced through to the best of my ability to insure that I've properly freed any instances before the application closes, but obviously I'm missing something.
So does anyone have any ideas on where to from here for debugging something like this?
P.S. once again I'm new, so if there is anything I've missed, glossed over, or forgot to add, please let me know. Thanks again for reading my post!
It is probably the Parent freeing all contained controls during Destroy.