I am making my own xml files using TinyXML. Everything saves out perfect apart from the declaration. It crashes inside the constructor for TiXmlDeclaration. When I comment out the TiXmlDeclaration line everything saves correctly (without crashing).
Random Code:
------------------------------- TiXmlDocument doc;
TiXmlDeclaration *dec = new TiXmlDeclaration ("1.0", 0, 0);
// Will never get this far doc.LinkEndChild (dec);
Call Stack (might be corrupted due to template params being turned into html):
---------------------
> Jail Break++.exe!strlen() Line 78 Asm Jail Break++.exe!std::char_traits<char>::length(const char * _First=0x00000000) Line 352 + 0x9 C++ Jail Break++.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const char * _Ptr=0x00000000) Line 622 + 0x9 C++ Jail Break++.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator=(const char * _Ptr=0x00000000) Line 473 C++ Jail Break++.exe!TiXmlDeclaration::TiXmlDeclaration(const char * _version=0x004f5a9c, const char * _encoding=0x00000000, const char * _standalone=0x00000000) Line 1248 C++ Jail Break++.exe!DataStore::Write(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & filename={...}) Line 72 + 0x5f C++ Jail Break++.exe!WinMain(HINSTANCE__ * instance=0x00400000, HINSTANCE__ * prev_instance=0x00000000, char * command_line=0x00141f52, int window_state=1) Line 31 + 0x1f C++ Jail Break++.exe!WinMainCRTStartup() Line 251 + 0x30 C kernel32.dll!7c816d4f() ntdll.dll!7c915b4f() kernel32.dll!7c8399f3()
It crashes on this line:
standalone = _standalone;
Any ideas?
Works fine in my build.
Are you defining TIXML_USE_STL?
The only thing I can think of is if you're using STL, then the assignment will be std::string standalone = 0
I would have thought it better to do use "", not 0. Try it and see.
But without STL the above works fine for me. HTH Ellers
Yep that sorted it - I was using an example from a website who had 0 in - I take it he wasn't using the STL version like I am.
Thanks!
Very interesting!
Would that website have been: http://software.ellerton.net/tinyxml.html
that is, the howto that I wrote?
Hmm. My bad. I will fix the example...
Ellers
ah so you're the reason I lost 3 hours work time debugging!!
Ah well, someone had to find it - just a shame it was me :).
Yep, thats me :)
Well chalk it up to learning the library. ;)
Log in to post a comment.
I am making my own xml files using TinyXML. Everything saves out perfect apart from the declaration. It crashes inside the constructor for TiXmlDeclaration. When I comment out the TiXmlDeclaration line everything saves correctly (without crashing).
Random Code:
-------------------------------
TiXmlDocument doc;
TiXmlDeclaration *dec = new TiXmlDeclaration ("1.0", 0, 0);
// Will never get this far
doc.LinkEndChild (dec);
Call Stack (might be corrupted due to template params being turned into html):
---------------------
> Jail Break++.exe!strlen() Line 78 Asm
Jail Break++.exe!std::char_traits<char>::length(const char * _First=0x00000000) Line 352 + 0x9 C++
Jail Break++.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const char * _Ptr=0x00000000) Line 622 + 0x9 C++
Jail Break++.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator=(const char * _Ptr=0x00000000) Line 473 C++
Jail Break++.exe!TiXmlDeclaration::TiXmlDeclaration(const char * _version=0x004f5a9c, const char * _encoding=0x00000000, const char * _standalone=0x00000000) Line 1248 C++
Jail Break++.exe!DataStore::Write(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & filename={...}) Line 72 + 0x5f C++
Jail Break++.exe!WinMain(HINSTANCE__ * instance=0x00400000, HINSTANCE__ * prev_instance=0x00000000, char * command_line=0x00141f52, int window_state=1) Line 31 + 0x1f C++
Jail Break++.exe!WinMainCRTStartup() Line 251 + 0x30 C
kernel32.dll!7c816d4f()
ntdll.dll!7c915b4f()
kernel32.dll!7c8399f3()
---------------------
It crashes on this line:
standalone = _standalone;
Any ideas?
Works fine in my build.
Are you defining TIXML_USE_STL?
The only thing I can think of is if you're using STL, then the assignment will be std::string standalone = 0
I would have thought it better to do use "", not 0. Try it and see.
But without STL the above works fine for me.
HTH
Ellers
Yep that sorted it - I was using an example from a website who had 0 in - I take it he wasn't using the STL version like I am.
Thanks!
Very interesting!
Would that website have been: http://software.ellerton.net/tinyxml.html
that is, the howto that I wrote?
Hmm. My bad. I will fix the example...
Ellers
ah so you're the reason I lost 3 hours work time debugging!!
Ah well, someone had to find it - just a shame it was me :).
Yep, thats me :)
Well chalk it up to learning the library. ;)