Hi vonhoff!
I revised your possible fix. I can't see the logic behind it, I'll share my thoughts here:
- block around line 100 is called for every xml attribute found inside the main "tileset" tag. Here the loader is just gathering all the attributes
- block around line 167 is called after the last "tileset" attribute has been issued, but before starting to process the next xml tag. Here the loader has all the xml attributes, so it proceeds to allocate memory for the required structures
- "property" and "tile" xml tags are always found after main "tileset", so the required structures are always found to be already created.
Moving the creation of structures inside the parsing of a single attribute before the whole set of attributes has been gathered would be premature, and potentially dangerous. So I won't do a pull request with a fix until we don't understand why it works.
That said, you're right wit the assumption that nondeterministic (random) behaviour happens with memory management issues, as well as with threading. These two components change their state outside the control of the application, so they can present a different state each time if not properly managed.
I'll do some tests, as the "cliffs" tileset is very prone to exhibit this behaviour.
Thanks a lot for your support!