Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Getting an Exception EAccessViolation on exit



Permlink Replies: 2 - Last Post: Oct 18, 2016 11:48 PM Last Post By: Jan Dijkstra
Doug Hay

Posts: 122
Registered: 5/26/05
Getting an Exception EAccessViolation on exit
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 18, 2016 11:26 AM
I moved some code out of my main form into separate .cpp files. Now when I exit the program I get Exception EAccessViolation. The Exception pops up and clears itself in 1/10 of a second, so it is not visible.

I moved quite a bit of code so I do not want to just restore it to a version that worked.

I added a destructor for my main form with a ShowMessage(), and this makes the Exception stay on the screen so I can see it (I saved a screen shot). www.douglashay.com/tracks/ExitError.PNG

I was wondering what is the best way to track down the issue?

Thanks for the help!
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Getting an Exception EAccessViolation on exit
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 18, 2016 1:10 PM   in response to: Doug Hay in response to: Doug Hay
Hello Doug,

I moved some code out of my main form into separate .cpp files. Now
when I exit the program I get Exception EAccessViolation.

Then you cearly broken something during the move. But we can't tell you
what that is without seeing your actual code.

I moved quite a bit of code so I do not want to just restore it to a
version that worked.

That is what version control systems are good for.

I added a destructor for my main form with a ShowMessage(), and this
makes the Exception stay on the screen so I can see it (I saved a
screen shot). www.douglashay.com/tracks/ExitError.PNG

That is not useful information to us, since we can't access your project,
see its .map file, etc.

I was wondering what is the best way to track down the issue?

Did you try using the debugger yet? Have you tried installing an exception
logging solution, like MadExcept, EurekaLog, JcDebug, etc?

--
Remy Lebeau (TeamB)
Jan Dijkstra

Posts: 206
Registered: 11/4/99
Re: Getting an Exception EAccessViolation on exit
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 18, 2016 11:48 PM   in response to: Doug Hay in response to: Doug Hay
Doug Hay wrote:
I moved some code out of my main form into separate .cpp files. Now when I exit the program I get Exception EAccessViolation. The Exception pops up and clears itself in 1/10 of a second, so it is not visible.

I moved quite a bit of code so I do not want to just restore it to a version that worked.

I added a destructor for my main form with a ShowMessage(), and this makes the Exception stay on the screen so I can see it (I saved a screen shot). www.douglashay.com/tracks/ExitError.PNG

I was wondering what is the best way to track down the issue?

Thanks for the help!

Could be caused by the order in which exit procedures are called. That's what I dealt with recently.

Running a form from the main startup module by calling ShowModal on it (without calling Application->Run) would cause an access violation upon application exit. Turned out to be caused by VCL finalize clauses being executed before the form(s) were cleaned up. Application->Run prevents this by changing the priority order of the finalize routines, to make sure the forms are deleted first.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02