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

Author Topic: Game crashing on close in debug mode  (Read 2280 times)

0 Members and 1 Guest are viewing this topic.

BackwardSpy

  • Newbie
  • *
  • Posts: 5
    • View Profile
Game crashing on close in debug mode
« on: July 11, 2010, 06:14:47 pm »
Here's the original post from another forum:
Quote
I started writing a little game as a project for me and my father to work on

I've been putting in some little things such as a simple game state class and so on, and most recently I've been working on a GUI system.

I added a button, and that all goes fine, but then I decided to add a label, and it KIND OF works, but if mUseImage (i.e it draws with an sf::Text object) is set to false when the program closes in debug mode, it crashes.
I haven't got any experience with these sorts of errors, could anyone help me out here?
I'm not just asking for someone to fix it, I want to know what caused it in the first place so I can fix them myself in future.
Download link:
http://zerospacegame.googlecode.com/svn/trunk/

It breaks into xmtx.c (Not one of my file, I don't know what it is)
Error:
Code: [Select]
Unhandled exception at 0x77df598e in VS2010.exe: 0xC0000005: Access violation reading location 0xfeeefef6.
Code it breaks at:
Code: [Select]
_RELIABILITY_CONTRACT
void  __CLRCALL_PURE_OR_CDECL _Mtxlock(_Rmtx *_Mtx)
{ /* lock mutex */
#ifdef _M_CEE
System::Threading::Thread::BeginThreadAffinity();
#endif
EnterCriticalSection(_Mtx);
} // Arrow points here when it breaks


Console outputs:
Code: [Select]
An internal OpenGL call failed in image.cpp (758) : GL_INVALID_OERATION, the specified operation is not allowed in the current sate
Image.cpp isn't one of my files either, I think it may be an SFML file

I was told it may be an issue with SFML2:
Quote
It sounds like an access violation happens in sf::Image's destructor (in image.cpp), after it ignores the fact that OpenGL errored. Exceptions thrown in destructors... is pretty much not recoverable. The access violation would have to be fixed, or the OpenGL code repaired.


Can anyone confirm this, and/or tell me the best way to fix it?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Game crashing on close in debug mode
« Reply #1 on: July 11, 2010, 08:18:07 pm »
Quote
It breaks into xmtx.c

And in your own code, where does it break?

You should also try to extract a complete and minimal code that reproduces this problem. A complete project is hard to browse for errors, it's much easier if you already remove the 99 percents of the code that are not relevant.

Also, make sure that your graphics drivers are up-to-date.

And... what OS and graphics card do you have?
Laurent Gomila - SFML developer

BackwardSpy

  • Newbie
  • *
  • Posts: 5
    • View Profile
Game crashing on close in debug mode
« Reply #2 on: July 11, 2010, 08:43:39 pm »
I had a look through the call stack (I'm very inexperienced in this area though, so I may have got something wrong) And it seems it's somewhere around the destructor for my content loader

I will work on a minimal piece of code that reproduces this error, sorry for not doing one already!

My graphics drivers are up to date, and my hardware is:
nVidia GeForce 9600 GT ; 1GB onboard RAM
OS:
Windows 7 Professional x64