* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2010 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
{
}
+// This trick detects heap allocations of refcountbase objects
+static void* last_heap = NULL;
+
+void* refcountbase::operator new(size_t size)
+{
+ last_heap = ::operator new(size);
+ return last_heap;
+}
+
+void refcountbase::operator delete(void* obj)
+{
+ if (last_heap == obj)
+ last_heap = NULL;
+ ::operator delete(obj);
+}
+
refcountbase::refcountbase() : refcount(0)
{
+ if (this != last_heap)
+ throw CoreException("Reference allocate on the stack!");
}
refcountbase::~refcountbase()
(void*)this, refcount);
}
-ExtensionItem::ExtensionItem(const std::string& Key, Module* mod) : key(Key), owner(mod)
+usecountbase::~usecountbase()
+{
+ if (usecount && ServerInstance && ServerInstance->Logs)
+ ServerInstance->Logs->Log("CULLLIST", DEBUG, "usecountbase::~ @%p with refcount %d",
+ (void*)this, usecount);
+}
+
+ServiceProvider::~ServiceProvider()
+{
+}
+
+ExtensionItem::ExtensionItem(const std::string& Key, Module* mod) : ServiceProvider(mod, Key, SERVICE_METADATA)
{
}
void ExtensionManager::Register(ExtensionItem* item)
{
- types.insert(std::make_pair(item->key, item));
+ types.insert(std::make_pair(item->name, item));
}
void ExtensionManager::BeginUnregister(Module* module, std::vector<reference<ExtensionItem> >& list)
{
std::map<std::string, reference<ExtensionItem> >::iterator me = i++;
ExtensionItem* item = me->second;
- if (item->owner == module)
+ if (item->creator == module)
{
list.push_back(item);
types.erase(me);
{
}
-ModuleRef::ModuleRef(Module* v) : value(v)
-{
- if (value) inc(value);
-}
-
-ModuleRef::~ModuleRef()
-{
- if (value) dec(value);
-}