1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 10:43:14 +02:00

Unset extensibles on larger objects when they destruct

Some complex extensibles require the full object to still be alive in
their destructors to keep proper bookkeeping
This commit is contained in:
Adam
2015-07-13 17:59:14 -04:00
parent 4362f53cc3
commit ceddb8370c
8 changed files with 19 additions and 0 deletions
+2
View File
@@ -40,6 +40,8 @@ class CoreExport Extensible
virtual ~Extensible();
void UnsetExtensibles();
template<typename T> T* GetExt(const Anope::string &name) const;
bool HasExt(const Anope::string &name) const;
+2
View File
@@ -52,6 +52,8 @@ Channel::Channel(const Anope::string &nname, time_t ts)
Channel::~Channel()
{
UnsetExtensibles();
FOREACH_MOD(OnChannelDelete, (this));
ModeManager::StackerDel(this);
+5
View File
@@ -23,6 +23,11 @@ ExtensibleBase::~ExtensibleBase()
}
Extensible::~Extensible()
{
UnsetExtensibles();
}
void Extensible::UnsetExtensibles()
{
while (!extension_items.empty())
(*extension_items.begin())->Unset(this);
+2
View File
@@ -64,6 +64,8 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt
Module::~Module()
{
UnsetExtensibles();
/* Detach all event hooks for this module */
ModuleManager::DetachAll(this);
IdentifyRequest::ModuleUnload(this);
+2
View File
@@ -51,6 +51,8 @@ NickAlias::NickAlias(const Anope::string &nickname, NickCore* nickcore) : Serial
NickAlias::~NickAlias()
{
UnsetExtensibles();
FOREACH_MOD(OnDelNick, (this));
/* Accept nicks that have no core, because of database load functions */
+2
View File
@@ -38,6 +38,8 @@ NickCore::NickCore(const Anope::string &coredisplay) : Serializable("NickCore"),
NickCore::~NickCore()
{
UnsetExtensibles();
FOREACH_MOD(OnDelCore, (this));
if (!this->chanaccess->empty())
+2
View File
@@ -142,6 +142,8 @@ ChannelInfo::ChannelInfo(const ChannelInfo &ci) : Serializable("ChannelInfo"),
ChannelInfo::~ChannelInfo()
{
UnsetExtensibles();
FOREACH_MOD(OnDelChan, (this));
Log(LOG_DEBUG) << "Deleting channel " << this->name;
+2
View File
@@ -292,6 +292,8 @@ void User::SetRealname(const Anope::string &srealname)
User::~User()
{
UnsetExtensibles();
if (this->server != NULL)
{
if (this->server->IsSynced())