What's the best way of doing this?
Posted on 2002-05-30
We have some old code which is possibly causing us headache. We keep getting access violations all the time, and I can't work out where the problem starts.
The person who originally wrote the code did things a little differently to what I'm used to, and I'm trying to work out if this is OK or not.
The form is dynamically created:
MktForm := MktForm.Create(Self);
in MktForm, this is done:
Action := caFree;
MktForm := nil;
Is this OK to do? Is instructing the Action to free the form on close, plus setting it to Nil in the FormDestroy allowed?
I can't trace the source to where the A/V occurs. It's annoying the hell out of me. It only happens sometimes (when a certain sequence of clicks is made). So I'm trying to find all dynamically created objects and make sure they're all freed. There are a lot of them, but the majority aren't called in most circumstances so it's not causing my general problem.
Any help would be appreciated.