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:
[url]http://zerospacegame.googlecode.com/svn/trunk/[/url]
Thank you in advance.
At which line does it crash and what message does the debugger output?
That's the problem, I don't have a clue
It breaks into xmtx.c (Not one of my file, I don't know what it is)
Error:
[code]Unhandled exception at 0x77df598e in VS2010.exe: 0xC0000005: Access violation reading location 0xfeeefef6.[/code]
Code it breaks at:
[cpp]_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[/cpp]
Console outputs:
[code]An internal OpenGL call failed in image.cpp (758) : GL_INVALID_OERATION, the specified operation is not allowed in the current sate[/code]
Image.cpp isn't one of my files either, I think it may be an SFML file
Then go down the callstack until you find one of your functions.
And how do I find this "callstack"?
[QUOTE=Chris220;23273874]And how do I find this "callstack"?[/QUOTE]
Depends on your debugger, or if you're using an IDE, your IDE.
Found it.
I found my content loader's destructor in there, so I breakpointed the destructor and re-ran the application.
Hit close, and it went to the breakpoint. F11 to step into, and boom, error pops up.
So now I know where it is, but not sure what I'm supposed to do to fix it.
Note: My content loader doesn't actually have anything inside the destructor, I never know what kind of things are supposed to go there
Does your class with an erronous default constructor happen to hold an sf::Image value?
It's a Label class, and it inherits from the Control class, which holds an sf::Image
Do I have to somehow dispose of this image?
[QUOTE=Chris220;23276000]It's a Label class, and it inherits from the Control class, which holds an sf::Image
Do I have to somehow dispose of this image?[/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.
Sorry, you need to Log In to post a reply to this thread.