]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Clean up crash on destruction of statics at exit
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 16 Oct 2009 15:43:53 +0000 (15:43 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 16 Oct 2009 15:43:53 +0000 (15:43 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11877 e03df62e-2008-0410-955e-edbf42e46eb7

src/mode.cpp
src/modules/m_banexception.cpp
src/modules/m_inviteexception.cpp
src/modules/m_namedmodes.cpp
src/server.cpp

index 98b5fe8c424ed97f0ebe599cf27776084a2ce917..03d0b52696064d318b9134c52075980cfb69bdf7 100644 (file)
@@ -57,7 +57,8 @@ ModeHandler::ModeHandler(Module* Creator, const std::string& Name, char modelett
 
 ModeHandler::~ModeHandler()
 {
-       ServerInstance->Modes->DelMode(this);
+       if (ServerInstance)
+               ServerInstance->Modes->DelMode(this);
 }
 
 bool ModeHandler::IsListMode()
index aac8fe7763e99117b30ce425b461b0508b68b4f2..5059fbbed437ba67f72fb1fb8cd2e990f8b14679 100644 (file)
@@ -44,7 +44,6 @@ public:
        {
                if (!ServerInstance->Modes->AddMode(&be))
                        throw ModuleException("Could not add new modes!");
-               ServerInstance->Modules->PublishInterface("ChannelBanList", this);
 
                be.DoImplements(this);
                Implementation list[] = { I_OnRehash, I_On005Numeric, I_OnExtBanCheck, I_OnCheckChannelBan };
@@ -123,12 +122,7 @@ public:
 
        Version GetVersion()
        {
-               return Version("Provides support for the +e channel mode", VF_COMMON | VF_VENDOR, API_VERSION);
-       }
-
-       ~ModuleBanException()
-       {
-               ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
+               return Version("Provides support for the +e channel mode", VF_COMMON | VF_VENDOR);
        }
 };
 
index 7fe7d40dccc261fb790f5d2c865bff5bd06fec29..9d0e0f54ecf1bde906450ecf16f7a09c98a629ba 100644 (file)
@@ -43,7 +43,6 @@ public:
        {
                if (!ServerInstance->Modes->AddMode(&ie))
                        throw ModuleException("Could not add new modes!");
-               ServerInstance->Modules->PublishInterface("ChannelBanList", this);
 
                ie.DoImplements(this);
                Implementation eventlist[] = { I_On005Numeric, I_OnCheckInvite };
@@ -62,7 +61,6 @@ public:
                        modelist* list = ie.extItem.get(chan);
                        if (list)
                        {
-                               std::string mask = std::string(user->nick) + "!" + user->ident + "@" + user->GetIPString();
                                for (modelist::iterator it = list->begin(); it != list->end(); it++)
                                {
                                        if (chan->CheckBan(user, it->mask))
@@ -71,7 +69,6 @@ public:
                                        }
                                }
                        }
-                       // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
                }
 
                return MOD_RES_PASSTHRU;
@@ -94,12 +91,7 @@ public:
 
        Version GetVersion()
        {
-               return Version("Provides support for the +I channel mode", VF_VENDOR | VF_COMMON, API_VERSION);
-       }
-
-       ~ModuleInviteException()
-       {
-               ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
+               return Version("Provides support for the +I channel mode", VF_VENDOR | VF_COMMON);
        }
 };
 
index 4bf8960e15058321147394a4375a2520f2ccd880..bc8279f698922c6a5a9ddb3ad3e32e9121c6a77d 100644 (file)
@@ -27,6 +27,11 @@ class ModuleNamedModes : public Module
                return Version("Provides the ability to manipulate modes via long names.",VF_VENDOR);
        }
 
+       void Prioritize()
+       {
+               ServerInstance->Modules->SetPriority(this, I_OnPreMode, PRIORITY_FIRST);
+       }
+
        void On005Numeric(std::string& line)
        {
                std::string::size_type pos = line.find(" CHANMODES=");
index e5546654eec6372a180f3f74e34c7d73296b27ce..08534897688e79666f31b2f231a234887180d900 100644 (file)
@@ -44,6 +44,7 @@ void InspIRCd::Exit(int status)
                this->SendError("Exiting with status " + ConvToStr(status) + " (" + std::string(ExitCodes[status]) + ")");
                this->Cleanup();
                delete this;
+               ServerInstance = NULL;
        }
        exit (status);
 }