[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Access Violation when freeing a child form

I'm writing an MDI app. When the child forms are closed I want them to close rather than be minimised, so I've added

Action := caFree;

to the form's OnClose event. Now whenever the child form is closed I get

Project Calls.exe raised exception class EAccessViolation with message 'Access violation at address 00000000. Read of address 00000000'. Process stopped etc

If I don't add the action := cafree line the form minimises and I don't get an error.

Thanks for your help.
0
riccohb
Asked:
riccohb
  • 6
  • 5
  • 2
  • +2
1 Solution
 
kretzschmarCommented:
too rare information,

caFree work normally properly,
there must be some other

maybe a object-reference on the form,
which is lost if you free the form

meikl ;-)
0
 
Lee_NoverCommented:
yep, most probably reference to some freed pointer (object)
0
 
jswebyCommented:
Is "Action := caFree" the last line in your FormClose event?

J.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
riccohbAuthor Commented:
I've just added a blank form to the project with just Action := caFree in the form's OnClose event and the problem still happened.

jsweby - yes, it is the last line. Usually it's the only line in that procedure.
0
 
jswebyCommented:
Can you show us how you are creating the form - the whole procedure where you decide you want to show the form.

J.
0
 
swift99Commented:
It sounds like your master form is looking at an object on the form you're freeing.  Or you may have a recursive reference.
0
 
riccohbAuthor Commented:
The master form was, as you say, referencing the form immediately after it closed.

I'll also give points to jsweby in a 'points for jsweby' question.

Thanks folks.
0
 
kretzschmarCommented:
and me?

at least i suggested
>maybe a object-reference on the form,
>which is lost if you free the form
first

meikl ;-)

0
 
kretzschmarCommented:
maybe i was ignored :-(
0
 
riccohbAuthor Commented:
Sorry Kretzschmar. I inadvertently overlooked you. An honest mistake! I've just awarded my last 40 points to jsweby but I'm about to go on an answering spree to earn more points, and when I do I'll ask a 'points for kretzschmar' question.
0
 
kretzschmarCommented:
well, ok ;-)
0
 
kretzschmarCommented:
some days ago . . .
0
 
riccohbAuthor Commented:
Patience...
0
 
riccohbAuthor Commented:
Kretzchmar - I've now posted your 'points for Kretzschmar' question.
0
 
kretzschmarCommented:
thanks
yippi :-))
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 6
  • 5
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now