Var: pass IntrusivePtr to add_global(), add_local() etc.

Those functions don't have a well-defined reference passing API, and
we had lots of memory leaks here.  By using IntrusivePtr, reference
ownership is well-defined.
This commit is contained in:
Max Kellermann 2020-02-26 05:28:21 +01:00
parent 17a2f1a3ab
commit 2c0ece7376
5 changed files with 85 additions and 101 deletions

View file

@ -134,7 +134,7 @@ ComponentManager<T, C>::ComponentManager(const string& arg_module, const string&
tag_enum_type(make_intrusive<EnumType>(module + "::" + local_id))
{
::ID* id = install_ID(local_id.c_str(), module.c_str(), true, true);
add_type(id, tag_enum_type.get(), 0);
add_type(id, tag_enum_type, 0);
zeekygen_mgr->Identifier(id);
}