Skip to content

fix: XML archive closes a completed document even while unwinding - #361

Merged
gennaroprota merged 1 commit into
developfrom
fix/xml-oarchive-writes-end-tag-when-document-complete
Jul 30, 2026
Merged

fix: XML archive closes a completed document even while unwinding#361
gennaroprota merged 1 commit into
developfrom
fix/xml-oarchive-writes-end-tag-when-document-complete

Conversation

@gennaroprota

Copy link
Copy Markdown
Collaborator

The XML output archive writes the closing </boost_serialization> tag in its destructor, but skipped it whenever an exception was unwinding the stack (uncaught_exceptions() > 0). That guard cannot tell an interrupted serialization from a completed one: when a fully written archive happened to be destroyed during unwinding for an unrelated reason (e.g. a later throw), its closing tag was silently dropped, leaving a corrupt file that fails to load (and, via #220, terminates the reader).

So, always try to add the closing tag when the document is complete.

Fixes #188.

The XML output archive writes the closing `</boost_serialization>` tag
in its destructor, but skipped it whenever an exception was unwinding
the stack (`uncaught_exceptions() > 0`). That guard cannot tell an
interrupted serialization from a completed one: when a fully written
archive happened to be destroyed during unwinding for an unrelated
reason (e.g. a later throw), its closing tag was silently dropped,
leaving a corrupt file that fails to load (and, via #220, terminates the
reader).

So, always try to add the closing tag when the document is complete.

Fixes #188.
@gennaroprota
gennaroprota added this pull request to the merge queue Jul 30, 2026
Merged via the queue into develop with commit 29b877c Jul 30, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xml_oarchieve fails to write </boost_serialization> end tag when exception is active

1 participant