summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-09-22 14:56:43 -0400
committerAdam <Adam@anope.org>2010-09-22 14:56:43 -0400
commit05e6815d912f0418f6da25a2106dd718796f02fa (patch)
tree40f7f54db2d6c69165b915a4a8f0ad9d9df36777 /src
parent34592069801b11d852b7f4d7cb1594e72058f8c3 (diff)
Do not use new/delete to allocate modules, allows modules to always destruct properly and automatically
Diffstat (limited to 'src')
-rw-r--r--src/modulemanager.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index 8e4329581..5fab83ff9 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -256,22 +256,8 @@ void ModuleManager::DeleteModule(Module *m)
ano_module_t handle = m->handle;
Anope::string filename = m->filename;
- ano_modclearerr();
- void (*destroy_func)(Module *m) = function_cast<void (*)(Module *)>(dlsym(m->handle, "AnopeFini"));
- const char *err = ano_moderr();
- if (!destroy_func && err && *err)
- {
- Log() << "No destroy function found, chancing delete...";
- delete m; /* we just have to chance they haven't overwrote the delete operator then... */
- }
- else
- destroy_func(m); /* Let the module delete it self, just in case */
-
- if (handle)
- {
- if (dlclose(handle))
- Log() << ano_moderr();
- }
+ if (handle && dlclose(handle))
+ Log() << ano_moderr();
if (!filename.empty())
DeleteFile(filename.c_str());