{"issue":{"milestone":null,"user":{"id":825465,"login":"RevenantX","url":"https://api.github.com/users/RevenantX","avatar_url":"https://secure.gravatar.com/avatar/c8b6a5e54c6625045fd5dcd59e71df7b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c8b6a5e54c6625045fd5dcd59e71df7b"},"title":"sf::Text crash on destroy when using char buffer","created_at":"2011-12-17T16:35:32Z","updated_at":"2011-12-19T12:25:34Z","labels":[],"state":"open","id":2589417,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"html_url":"https://github.com/LaurentGomila/SFML/issues/136","closed_at":null,"body":"This code cause to crash\r\n\r\n```cpp\r\nvoid GGameEngine::DrawDebugText( int x, int y, const char *text, ...)\r\n{\r\n\tva_list args;\r\n\tsf::Text debugText;\r\n\tchar buf[1024];\r\n\r\n\t// Formatting text\r\n\tva_start(args, text);\r\n\tvsprintf(buf, text, args);\r\n\tva_end(args);\r\n\r\n\t// Setup text\r\n\tdebugText = sf::Text(buf,debugFont, 12);\r\n\tdebugText.SetPosition((float)x, (float)y);\r\n\r\n\t// Render to screen\r\n\twindow.Draw(debugText);\r\n}\r\n```\r\n\r\nbut this not\r\n\r\n```cpp\r\nvoid GGameEngine::DrawDebugText( int x, int y, const char *text, ...)\r\n{\r\n\tva_list args;\r\n\tsf::Text debugText;\r\n\tchar buf[1024];\r\n\r\n\t// Formatting text\r\n\tva_start(args, text);\r\n\tvsprintf(buf, text, args);\r\n\tva_end(args);\r\n\r\n\t// Setup text\r\n\tdebugText = sf::Text(\"SOME TEXT',debugFont, 12);\r\n\tdebugText.SetPosition((float)x, (float)y);\r\n\r\n\t// Render to screen\r\n\twindow.Draw(debugText);\r\n}\r\n```\r\n","number":136,"url":"https://api.github.com/repos/LaurentGomila/SFML/issues/136","comments":8,"assignee":null},"comment":{"user":{"id":825465,"login":"RevenantX","url":"https://api.github.com/users/RevenantX","avatar_url":"https://secure.gravatar.com/avatar/c8b6a5e54c6625045fd5dcd59e71df7b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c8b6a5e54c6625045fd5dcd59e71df7b"},"created_at":"2011-12-19T12:25:34Z","updated_at":"2011-12-19T12:25:34Z","id":3202543,"body":"Call stack\r\n\r\n>\tsfml-graphics-d-2.dll!_CrtIsValidHeapPointer(const void * pUserData=0x5ec3bc06)  Line 2103\tC++\r\n \t024b0000()\t\r\n \tKernelBase.dll!76774bf9() \t\r\n \tsfml-graphics-d-2.dll!_CrtIsValidHeapPointer(const void * pUserData=0x009046c8)  Line 2103\tC++\r\n \tsfml-graphics-d-2.dll!_free_dbg_nolock(void * pUserData=0x009046c8, int nBlockUse=1)  Line 1317 + 0x9 bytes\tC++\r\n \tsfml-graphics-d-2.dll!_free_dbg(void * pUserData=0x009046c8, int nBlockUse=1)  Line 1258 + 0xd bytes\tC++\r\n \tsfml-graphics-d-2.dll!operator delete(void * pUserData=0x009046c8)  Line 54 + 0x10 bytes\tC++\r\n \tsfml-graphics-d-2.dll!std::allocator<unsigned int>::deallocate(unsigned int * _Ptr=0x009046c8, unsigned int __formal=8)  Line 140 + 0x9 bytes\tC++\r\n \tsfml-graphics-d-2.dll!std::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >::_Tidy(bool _Built=true, unsigned int _Newsize=0)  Line 2158\tC++\r\n \tsfml-graphics-d-2.dll!std::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >::~basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >()  Line 907\tC++\r\n \tsfml-graphics-d-2.dll!sf::String::~String()  + 0x16 bytes\tC++\r\n \tsfml-graphics-d-2.dll!sf::Text::~Text()  + 0x42 bytes\tC++\r\n \tXDoom2D.exe!main(int argc=1, char * * argv=0x007b23d0)  Line 22 + 0x44 bytes\tC++\r\n \tXDoom2D.exe!__tmainCRTStartup()  Line 266 + 0x19 bytes\tC\r\n \tXDoom2D.exe!mainCRTStartup()  Line 182\tC\r\n \tkernel32.dll!74d6339a() \t\r\n \tntdll.dll!77029ed2() \t\r\n \tntdll.dll!77029ea5() \t\r\n\r\nthis code crash too\r\nint main(int argc, char **argv)\r\n{\r\n\tsf::RenderWindow window;\r\n\tsf::Text text;\r\n\tsf::Font font;\r\n\r\n\twindow.Create(sf::VideoMode(800, 600), \"SFML window\");\r\n\r\n\tfont.LoadFromFile(\"lucon.ttf\");\r\n\ttext.SetFont(font);\r\n\ttext.SetString(\"OLOLO\");\r\n\r\n\treturn 0;\r\n}","url":"https://api.github.com/repos/LaurentGomila/SFML/issues/comments/3202543"},"action":"created"}