diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-01-17 16:00:14 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-01-17 16:00:14 +0000 |
commit | 4b6bdeccb537b6f8030172c37afa7dc324e26765 (patch) | |
tree | 9c165894ba0a62072f81630fbba789770f2b63ba /src/modmanager_dynamic.cpp | |
parent | 92974819e3bf1c3a97b83f6f4ccc612283120794 (diff) |
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
Diffstat (limited to 'src/modmanager_dynamic.cpp')
-rw-r--r-- | src/modmanager_dynamic.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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(); |