SFML community forums

Help => General => Topic started by: Splux on May 07, 2012, 09:58:46 pm

Title: [SOLVED]"Unhandled exception" when exiting application
Post by: Splux on May 07, 2012, 09:58:46 pm
Solution:
Use a custom font for sf::Text...


Hi,

so, now me and some friends have started making a game from scratch using SFML (obviously..) and we have one problem that we cannot solve, neither can our programming teacher ( or he just refuses to explain how to solve this...);
we're getting this error when the program exits from main():
"Unhandled exception at 0x698ba051 in NTI-Zombie_Survival.exe: 0xC0000005: Access violation reading location 0x00000008."

It doesn't matter if we have an array of pointers to the objects or the objects itself, and it didn't help replacing the arrays with std::vector either (same goes for this, doesn't matter if we had a vector of pointers to the object or the object itself stored in the vector) we still got the error.

When did this error start?
No idea, after we made some changes (unfortunately before we started to document all the changes we do...) to the Player class and Zombie class is all that I can say.

Source code:
http://pastebin.com/ZNXLpskQ

If anyone can figure out why this is happening (or, a solution would be even better  ::) )... that'd be awesome.

Thanks in advance.

EDIT:
We are using SFML2 RC, forgot to mention that last night.
Title: Re: "Unhandled exception" when exiting application
Post by: Laurent on May 08, 2012, 04:29:29 pm
Quote
Source code:
http://pastebin.com/ZNXLpskQ
Please read this:
http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368
Title: Re: "Unhandled exception" when exiting application
Post by: Splux on May 08, 2012, 08:26:12 pm
Laurent:

Problem is, I cannot exclude any of the code - since I don't know exactly where it's going wrong. Neither can I reproduce the problem in any other projects.

So, I can't really do that much except for posting the full code... Sorry about that. Or, I could make it a guessing game and don't post any code at all! :D
Title: Re: "Unhandled exception" when exiting application
Post by: Rosme on May 12, 2012, 12:17:39 am
I do see a few sf::Text that are loaded with default font when construct. It probably comes from there.
Title: Re: "Unhandled exception" when exiting application
Post by: mateandmetal on May 12, 2012, 06:22:02 am
Build your proyect in Debug mode... And RUN the debugger!!! ;D
Title: Re: "Unhandled exception" when exiting application
Post by: Splux on May 14, 2012, 05:41:03 pm
mateandmetal:
"Unhandled exception at 0x698ba051 in NTI-Zombie_Survival.exe: 0xC0000005: Access violation reading location 0x00000008."

And that's the error it throws at me, when exiting main(). If you're running the application in Release, it won't throw any error like that - only crash and ask if I want to report it to Microsoft ;)

Also, debugging in dbgdel.cpp is something I don't feel that comfortable doing... :P

Rosme:
Going to try and change that and see if it makes any difference, thanks!

*EDIT*
Thanks a lot Rosme! That was the issue, just tried to load a custom font instead of using getDefaultFont() (which appearently was what the default constructor was using... stupid of me that I didn't think of that first time...) and now it closes without throwing errors at me!

So, thanks!