Skip to content

Replace tinyxml with tinyxml2#4942

Open
Lpsd wants to merge 9 commits into
multitheftauto:masterfrom
Lpsd:tinyxml2
Open

Replace tinyxml with tinyxml2#4942
Lpsd wants to merge 9 commits into
multitheftauto:masterfrom
Lpsd:tinyxml2

Conversation

@Lpsd

@Lpsd Lpsd commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the unmaintained tinyxml library with tinyxml2 11.x (master: https://github.com/leethomason/tinyxml2).

The full XML wrapper layer (CXMLImpl, CXMLFileImpl, CXMLNodeImpl, CXMLAttributeImpl, CXMLAttributesImpl) has been updated to the new API. tinyxml2 ships as a single header and .cpp with no extra dependencies, so it drops straight into vendor/ alongside the existing premake setup.

Motivation

tinyxml(1) has not been updated for a long time.

tinyxml2 is actively maintained by the same original author, handles the same XML subset we use, and has a cleaner modern C++ API.

Notable differences from the old library

This is not a fully transparent swap -- the two libraries have meaningfully different ownership semantics:

  • In tinyxml2, the XMLDocument owns all nodes. Deleting a node from inside a wrapper destructor triggers tinyxml2's own recursive child cleanup, which conflicts with our wrapper tree teardown order. The wrapper destructors now leave element cleanup to the document.
  • XMLAttribute in tinyxml2 is not a heap-allocatable object -- it is an intrusive member of the element's attribute list. CXMLAttributeImpl was rewritten to hold a const XMLAttribute* pointer and refresh it after any mutation.
  • Windows SDK msxml.h declares a global ::XMLDocument class. Using namespace tinyxml2 in CXMLImpl.cpp caused ambiguity at compile time, fixed by using explicit tinyxml2:: prefixes throughout that file.

Test plan

Start the server with default resources and confirm it launches without issues/crashing.

Also worth checking (already tested lightly):

  • getResourceInfo() returns correct values (reads from the CopyNode settings node)
  • xmlLoadFile / xmlLoadString work from Lua scripts
  • XML systems (such as ACL) are working, e.g: aclrequest allow <resource> all successfully saves the acl.xml

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

@Lpsd Lpsd added the upstream Related to vendor library label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Related to vendor library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant