From: Attila Molnar Date: Mon, 10 Feb 2014 12:56:14 +0000 (+0100) Subject: Replace DummyExtItem with a flag in Extensible X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;ds=sidebyside;h=6fb7507c5801ed0a5e819ccf5c37da396fa21283;hp=034488fc4aca4fb85c923d881f4b95675eba37b6;p=user%2Fhenk%2Fcode%2Finspircd.git Replace DummyExtItem with a flag in Extensible --- diff --git a/include/extensible.h b/include/extensible.h index 4e6721414..a0544bba1 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -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) diff --git a/src/base.cpp b/src/base.cpp index cf28f8e7d..dc57a8434 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -174,20 +174,15 @@ void Extensible::doUnhookExtensions(const std::vector > } } -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); }