]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Replace DummyExtItem with a flag in Extensible
authorAttila Molnar <attilamolnar@hush.com>
Mon, 10 Feb 2014 12:56:14 +0000 (13:56 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Mon, 10 Feb 2014 12:56:14 +0000 (13:56 +0100)
include/extensible.h
src/base.cpp

index 4e6721414219b9237b34a173a536cc8b847e7f10..a0544bba1a8fa3156be969e92546e128bb9860b5 100644 (file)
@@ -84,6 +84,11 @@ class CoreExport Extensible : public classbase
         * Holds all extensible metadata for the class.
         */
        ExtensibleStore extensions;
+
+       /** True if this Extensible has been culled.
+        * A warning is generated if false on destruction.
+        */
+       unsigned int culled:1;
  public:
        /**
         * Get the extension items for iteraton (i.e. for metadata sync during netburst)
index cf28f8e7d34375359f1306d37ebde1c79af7415f..dc57a8434c8c82c157f933d15699ad4dcea05dc8 100644 (file)
@@ -174,20 +174,15 @@ void Extensible::doUnhookExtensions(const std::vector<reference<ExtensionItem> >
        }
 }
 
-static struct DummyExtensionItem : LocalExtItem
-{
-       DummyExtensionItem() : LocalExtItem("", NULL) {}
-       void free(void*) {}
-} dummy;
-
 Extensible::Extensible()
+       : culled(false)
 {
-       extensions[&dummy] = NULL;
 }
 
 CullResult Extensible::cull()
 {
        FreeAllExtItems();
+       culled = true;
        return classbase::cull();
 }
 
@@ -202,7 +197,7 @@ void Extensible::FreeAllExtItems()
 
 Extensible::~Extensible()
 {
-       if (!extensions.empty() && ServerInstance && ServerInstance->Logs)
+       if ((!extensions.empty() || !culled) && ServerInstance && ServerInstance->Logs)
                ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "Extensible destructor called without cull @%p", (void*)this);
 }