Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Crash using a static c++ class(Invalid Heap Address)
Crash using a static c++ class [message #1005837] Mon, 28 January 2013 22:41 Go to next message
Brad Jackson is currently offline Brad JacksonFriend
Messages: 2
Registered: January 2013
Junior Member
Has any one come across the problem where a native static class causes a crash?

This is the error eclipse is giving me.
index.php/fa/13128/0/

Not sure that the image is working, I couldn't see it in the preview. The error is an Invalid Heap Address.

//-------------------------------- 
int main(int argc, char* argv[]) 
{ 
   Engine::GetInstance().SetTitle("My Game"); // this is the line the crash occurs on. The set title function is never reached.

   return Engine::GetInstance().OnExecute(argc, argv); 
} 


The engine get instance code
//----------------------------------------------------- 
Engine &Engine::GetInstance() 
{ 
   static Engine staticInstance; 
   return staticInstance; 
} 


The engine code has nothing special in the constructor.
//----------------------------------------------------- 
Engine::Engine() : 
mRunning(false), 
mLostFocus(false), 
mEngineTitle("2d Engine"), 
mPitch(0), 
mBPP(8), 
mWidth(0), 
mHeight(0), 
mInitaliseGame(NULL), 
mUpdateGame(NULL), 
mRenderGame(NULL), 
mQuitGame(NULL), 
mLoadStaticData(NULL), 
mLostFocusCallback(NULL), 
mGainedFocusCallback(NULL), 
mHideKeyboardCallback(NULL), 
mTouchDown(NULL), 
mTouchMove(NULL), 
mTouchUp(NULL), 
mPaused(false), 
mKeyboardOffset(0), 
mKeyboardScroll(0), 
mTimeDelta(0.0f), 
#ifdef _DEBUG 
mSingleStep(false), 
#endif // _DEBUG 
#ifdef ANDROID 
mKeyboardMax(-220) 
#else // ANDROID 
mKeyboardMax(-262) 
#endif // ANDROID 
{ 
   LOG("Engine::Init()"); 
} 


I have used the code before in another project; any ideas would be great.

Thanks
Re: Crash using a static c++ class [message #1006594 is a reply to message #1005837] Fri, 01 February 2013 05:49 Go to previous message
Brad Jackson is currently offline Brad JacksonFriend
Messages: 2
Registered: January 2013
Junior Member
No ideas?

Sad
Previous Topic:Eclipse CDT Juno: fresh install on WinXP - no C/C++ perspective
Next Topic:Eclipse always returns 0 references found
Goto Forum:
  


Current Time: Tue Nov 25 22:27:06 GMT 2014

Powered by FUDForum. Page generated in 0.02017 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software