Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED]"Unhandled exception" when exiting application  (Read 3273 times)

0 Members and 1 Guest are viewing this topic.

Splux

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
[SOLVED]"Unhandled exception" when exiting application
« 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.
« Last Edit: May 14, 2012, 07:21:52 pm by Splux »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Laurent Gomila - SFML developer

Splux

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: "Unhandled exception" when exiting application
« Reply #2 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

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Re: "Unhandled exception" when exiting application
« Reply #3 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.
GitHub
Code Concept
Twitter
Rosme on IRC/Discord

mateandmetal

  • Full Member
  • ***
  • Posts: 171
  • The bird is the word
    • View Profile
    • my blog
Re: "Unhandled exception" when exiting application
« Reply #4 on: May 12, 2012, 06:22:02 am »
Build your proyect in Debug mode... And RUN the debugger!!! ;D
- Mate (beverage) addict
- Heavy metal addict _lml
- SFML 2 addict
- My first (and free) game: BichingISH!

Splux

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: "Unhandled exception" when exiting application
« Reply #5 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!
« Last Edit: May 14, 2012, 07:19:22 pm by Splux »