Solved

Access Violation when freeing a child form

Posted on 2002-07-29
15
330 Views
Last Modified: 2010-04-04
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
Comment
Question by:riccohb
  • 6
  • 5
  • 2
  • +2
15 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7186042
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
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7186509
yep, most probably reference to some freed pointer (object)
0
 
LVL 4

Expert Comment

by:jsweby
ID: 7186523
Is "Action := caFree" the last line in your FormClose event?

J.
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:riccohb
ID: 7187384
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
 
LVL 4

Expert Comment

by:jsweby
ID: 7187389
Can you show us how you are creating the form - the whole procedure where you decide you want to show the form.

J.
0
 
LVL 6

Accepted Solution

by:
swift99 earned 100 total points
ID: 7189063
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
 

Author Comment

by:riccohb
ID: 7190145
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7190153
and me?

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

meikl ;-)

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7190154
maybe i was ignored :-(
0
 

Author Comment

by:riccohb
ID: 7190185
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7193144
well, ok ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7202799
some days ago . . .
0
 

Author Comment

by:riccohb
ID: 7202818
Patience...
0
 

Author Comment

by:riccohb
ID: 7216422
Kretzchmar - I've now posted your 'points for Kretzschmar' question.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7216430
thanks
yippi :-))
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question