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:
@@ -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;
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ Channel::Channel(const Anope::string &nname, time_t ts)
|
||||
|
||||
Channel::~Channel()
|
||||
{
|
||||
UnsetExtensibles();
|
||||
|
||||
FOREACH_MOD(OnChannelDelete, (this));
|
||||
|
||||
ModeManager::StackerDel(this);
|
||||
|
||||
@@ -23,6 +23,11 @@ ExtensibleBase::~ExtensibleBase()
|
||||
}
|
||||
|
||||
Extensible::~Extensible()
|
||||
{
|
||||
UnsetExtensibles();
|
||||
}
|
||||
|
||||
void Extensible::UnsetExtensibles()
|
||||
{
|
||||
while (!extension_items.empty())
|
||||
(*extension_items.begin())->Unset(this);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -38,6 +38,8 @@ NickCore::NickCore(const Anope::string &coredisplay) : Serializable("NickCore"),
|
||||
|
||||
NickCore::~NickCore()
|
||||
{
|
||||
UnsetExtensibles();
|
||||
|
||||
FOREACH_MOD(OnDelCore, (this));
|
||||
|
||||
if (!this->chanaccess->empty())
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -292,6 +292,8 @@ void User::SetRealname(const Anope::string &srealname)
|
||||
|
||||
User::~User()
|
||||
{
|
||||
UnsetExtensibles();
|
||||
|
||||
if (this->server != NULL)
|
||||
{
|
||||
if (this->server->IsSynced())
|
||||
|
||||
Reference in New Issue
Block a user