I get unhandled exception when exiting my game (goes to IReferenceCounted.h to a section commented "someone is doing bad reference counting.").
The problem comes only when i run this function:
Code: Select all
void gameGFX_irr::writeWrap(int flags, float x, float y, int align, float width, const char * fmt, ...){
x+=offsetX;
y+=offsetY;
bool centered=false;
if(flags==TEXT_CENTER)
centered=true;
const int maxLetters=2048;
//prep string
char txt[maxLetters];
va_list va;
va_start( va, fmt );
vsprintf( txt, fmt, va );
va_end( va );
core::stringw str = txt;
const core::stringw strw(txt);
const wchar_t* w_str = strw.c_str();
irr::gui::IGUIStaticText * myText;
myText=myDevice->getGUIEnvironment()->addStaticText(w_str,rect2d(x,y,x+width,screenY),0,true);
myText->enableOverrideColor(true);
myText->setOverrideColor(TEXTCOLOR);
myText->setOverrideFont(font);
myText->draw();
myText->drop(); //fix this, floods memory if not dropped but if dropped gets me the problem described above
}
Thanks
Erik