Skip to content

Unregister only this module's type registration - #375

Merged
gennaroprota merged 1 commit into
developfrom
fix/unregister-only-this-modules-type-registration
Aug 14, 2026
Merged

Unregister only this module's type registration#375
gennaroprota merged 1 commit into
developfrom
fix/unregister-only-this-modules-type-registration

Conversation

@gennaroprota

Copy link
Copy Markdown
Collaborator

The type registry is a multiset ordered by std::type_info, so the registrations two modules make for the same type compare equal. type_unregister looked entries up by that ordering and erased every match, which meant the first module to be unloaded took the other modules' registrations with it. Serialization of that type then failed in a module still running, with unregistered_class, since get_derived_extended_type_info no longer found anything.

Remedy: erase the one entry which is this object, the way key_unregister has always done it for the registry keyed by export name.

Fixes #325.

The type registry is a multiset ordered by `std::type_info`, so the
registrations two modules make for the same type compare equal.
`type_unregister` looked entries up by that ordering and erased every
match, which meant the first module to be unloaded took the other
modules' registrations with it.  Serialization of that type then failed
in a module still running, with `unregistered_class`, since
`get_derived_extended_type_info` no longer found anything.

Remedy: erase the one entry which is this object, the way
`key_unregister` has always done it for the registry keyed by export
name.

Fixes #325.
@gennaroprota
gennaroprota force-pushed the fix/unregister-only-this-modules-type-registration branch from 46eee7c to 570601c Compare August 13, 2026 13:35
@gennaroprota
gennaroprota added this pull request to the merge queue Aug 14, 2026
Merged via the queue into develop with commit abb9a8a Aug 14, 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.

Incorrect unregistration (with exception thrown / crash) with multiple DLL's using Boost.Serialization

1 participant