diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-30 04:26:44 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-30 04:26:44 +0300 |
commit | e19cc122081ce2a9c5e7f338fcba5c13066227ca (patch) | |
tree | 14a0ca571d4408ada3f72b21be3edc43e2ac2715 | |
parent | 516c2cec67ca327e443f8bd7e75d92ca32fc69ec (diff) |
modified: core/commonheaders.h
modified: core/main.cpp
modified: core/modules.cpp
-rw-r--r-- | core/commonheaders.h | 5 | ||||
-rw-r--r-- | core/main.cpp | 18 | ||||
-rw-r--r-- | core/modules.cpp | 15 |
3 files changed, 37 insertions, 1 deletions
diff --git a/core/commonheaders.h b/core/commonheaders.h index 1bf5866..5cca301 100644 --- a/core/commonheaders.h +++ b/core/commonheaders.h @@ -3,9 +3,12 @@ #include <list> - +
+//boost #include <boost/thread.hpp> #include <boost/filesystem.hpp>
+#include <boost/shared_ptr.hpp>
+//ACE
#include <ace/ACE.h> #include <ace/DLL.h> #include <ace/OS_main.h>
diff --git a/core/main.cpp b/core/main.cpp index 13de647..5a27e20 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -38,3 +38,21 @@ int ACE_MAIN(int argc, char *argv[]) } +int on_exit() +{ + if(!services.empty()) + { + std::list<service*>::iterator end = services.end(); + for(std::list<service*>::iterator i = services.begin(); i != end; ++i) + delete *i; + services.clear(); + } + if(!plugins.empty()) + { + std::list<plugin*>::iterator end = plugins.end(); + for(std::list<plugin*>::iterator i = plugins.begin(); i != end; ++i) + delete *i; + plugins.clear(); + } + return 0; +}
\ No newline at end of file diff --git a/core/modules.cpp b/core/modules.cpp index 6518825..5b5186b 100644 --- a/core/modules.cpp +++ b/core/modules.cpp @@ -68,11 +68,26 @@ plugin::plugin(ACE_DLL *lib, PLUGININFO *info, exported_functions_s *funcs) { if(lib) plug = lib; + else + plug = NULL; if(info) plugininfo = info; + else + plugininfo = NULL; if(funcs) exported_funcs = funcs; + else + exported_funcs = NULL; } + +plugin::~plugin() +{ + if(plug) + delete plug; + if(exported_funcs) + delete exported_funcs; +} + const plugin::exported_functions_s* plugin::get_exported_functions() { return exported_funcs; |