Page 1 of 1
Unable to load scheme
Posted: Tue Feb 28, 2006 02:52
by BradDaBug
Whenever I try to load a scheme the program aborts. Here's the last few lines of the log file:
27/02/2006 20:02:56 (InfL1) Attempting to load Scheme from file '../datafiles/schemes/WindowsLook.scheme'.
27/02/2006 20:02:56 (Error) Exception: Scheme::xmlHandler::startElement - Unexpected data was found while parsing the Scheme file: '' is unknown.
27/02/2006 20:02:56 (Error) Scheme::Scheme - loading of Scheme from file '../datafiles/schemes/WindowsLook.scheme' failed.
I've got another simple project that loads the same schemes fine. As far as I can tell everything is the same for both projects, directory layout, scheme loading code, etc.
Also, Valgrind reports for both projects some invalid reads inside SchemeManager::loadScheme(), specifically down in TiXmlDocument::Parse() (tinyxmlparser.cpp:756), which calls TiXmlBase::SkipWhiteSpace() (tinyxmlparser.cpp:337). I'm not sure if they're related or not.
Any ideas?
Posted: Tue Feb 28, 2006 09:43
by martignasse
hi BradDaBug,
seem's like you'r xml file (scheme) is corrupted, can you post it, please.
You should use Xerces how can validate you'r xml file and is more explicit if fond errors.
hope it help
Posted: Tue Feb 28, 2006 09:43
by martignasse
hi BradDaBug,
seem's like you'r xml file (scheme) is corrupted, can you post it, please.
You should use Xerces how can validate you'r xml file and is more explicit if fond errors.
hope it help
Posted: Tue Feb 28, 2006 21:46
by BradDaBug
Here's the scheme I'm trying to load:
Code: Select all
<?xml version="1.0" ?>
<GUIScheme Name="WindowsLook">
<Imageset Name="WindowsLook" Filename="../datafiles/imagesets/WindowsLook.imageset" />
<WindowSet Filename="CEGUIWindowsLook" />
</GUIScheme>
Posted: Wed Mar 01, 2006 10:42
by martignasse
You'r scheme seem's ok, apparently.
But because you related TiXmlBase::SkipWhiteSpace() problems,
i looked more deeply and discover that you have an extra space caractere at the end of each lines, maybe it's that...
could be good to test whit xerces to see if the error occur and to validate you'r xml files.
hope it help.
Posted: Wed Mar 01, 2006 15:12
by BradDaBug
I'll have to test with Xerces later since I'm not at my computer.
If it is a problem with the spaces at the end of the lines, wouldn't that be a bug in TinyXML?
Posted: Thu Mar 02, 2006 01:34
by BradDaBug
Removing the spaces at the end of the lines did nothing.
Posted: Thu Mar 02, 2006 03:08
by BradDaBug
I rebuilt CEGUI using xerces and it worked fine. Then I built it again disabling xerces and using tinyxml and the problem is still there.
Posted: Thu Mar 02, 2006 09:20
by martignasse
I rebuilt CEGUI using xerces and it worked fine. Then I built it again disabling xerces and using tinyxml and the problem is still there.
Ok, at least, you can continu to work
So, the problem is in the tinyXml code.
did you modify it ?
are you on windows of linux ?
Posted: Thu Mar 02, 2006 10:15
by CrazyEddie
Do you have a blank like at the end of the scheme file? If not, does it help if you add one?
There is a potential issue in the TinyXML usage, you might be seeing this. Also, which version of the code are you using?
CE
Posted: Thu Mar 02, 2006 16:07
by BradDaBug
If you're talking about the null termination issue, I don't think that's it (I was discussing this with lindquist on irc last night) because I created a custom resource provider and added an extra null byte at the end of the buffer that I'm giving to tinyxml and that didn't do anything except fix one of the 1 byte read errors that valgrind was reporting.
I haven't edited TinyXML, and I'm on Linux.
I did some debugging last night and it looks like some strings are being corrupted. For instance, the GUIScheme attribute "Name" should have had a value of "TaharezLook", but it looked like it was being passed around as just "ook", and the address of the pointer was set 8 bytes ahead of where it should have been.
Posted: Fri Mar 03, 2006 06:14
by BradDaBug
It looks like that when a string is being passed to attrs.add() inside TinyXMLDocument::processElement() it's being cast wrong, since the String is being constructed with "ook" instead of "TaharezLook". At least thats the way it looks to me; there might be a reasonable explanation for that and it's not a problem at all.
I don't see why it would be a casting problem, since TinyXML is returing a char* and it's being cast as a utf8* prior to being sent to the String constructor, and utf8* is just a uint8* typedef.
Posted: Sat Mar 04, 2006 04:25
by BradDaBug
I can get TinyXML to work. I downloaded the latest version and copied that into the tinyxml directory of the source, edited tinyxml.h and added #define TIXML_USE_STL, and build CEGUI. Once I do that everything works and valgrind is happy. I haven't tried enabling STL in the version of tinyxml that comes with 0.4.1 of CEGUI by default.
So, what does this mean? TinyXML has a bug?
Posted: Sun Mar 05, 2006 15:57
by CrazyEddie
Hi
It's certainly possible that there's a bug in our TinyXML version, though I have not encountered the issue.
In the next release we will be doing away with as many of the embedded copies of libs as possible in order to facilitate better updating and 'sharing' of these libs.
CE.