diff --git a/src/plugin/ComponentManager.h b/src/plugin/ComponentManager.h index c8ff1d2791..848d989faa 100644 --- a/src/plugin/ComponentManager.h +++ b/src/plugin/ComponentManager.h @@ -4,6 +4,7 @@ #include #include +#include "IntrusivePtr.h" #include "Type.h" #include "Var.h" // for add_type() #include "Val.h" @@ -121,7 +122,7 @@ public: private: string module; /**< Script layer module in which component tags live. */ - EnumType* tag_enum_type; /**< Enum type of component tags. */ + IntrusivePtr tag_enum_type; /**< Enum type of component tags. */ map components_by_name; map components_by_tag; map components_by_val; @@ -129,11 +130,11 @@ private: template ComponentManager::ComponentManager(const string& arg_module, const string& local_id) - : module(arg_module) + : module(arg_module), + tag_enum_type(make_intrusive(module + "::" + local_id)) { - tag_enum_type = new EnumType(module + "::" + local_id); ::ID* id = install_ID(local_id.c_str(), module.c_str(), true, true); - add_type(id, tag_enum_type, 0); + add_type(id, tag_enum_type.get(), 0); zeekygen_mgr->Identifier(id); } @@ -158,7 +159,7 @@ list ComponentManager::GetComponents() const template EnumType* ComponentManager::GetTagEnumType() const { - return tag_enum_type; + return tag_enum_type.get(); } template