From 4b6bdeccb537b6f8030172c37afa7dc324e26765 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 17 Jan 2010 16:00:14 +0000 Subject: Add Module::init() for correct exception handling during hook registration git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12278 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modmanager_dynamic.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/modmanager_dynamic.cpp') diff --git a/src/modmanager_dynamic.cpp b/src/modmanager_dynamic.cpp index 900562260..1fcf3aa56 100644 --- a/src/modmanager_dynamic.cpp +++ b/src/modmanager_dynamic.cpp @@ -89,11 +89,12 @@ bool ModuleManager::Load(const char* filename) newmod->ModuleSourceFile = filename_str; newmod->ModuleDLLManager = newhandle; Version v = newmod->GetVersion(); + Modules[filename_str] = newmod; + + newmod->init(); ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (Module version %s)%s", filename, newhandle->GetVersion().c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]")); - - Modules[filename_str] = newmod; } else { @@ -106,6 +107,8 @@ bool ModuleManager::Load(const char* filename) catch (CoreException& modexcept) { // failure in module constructor + if (newmod) + DoSafeUnload(newmod); delete newmod; delete newhandle; LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason(); -- cgit v1.2.3