diff options
Diffstat (limited to 'project2/xmlObjectLoader.cpp')
-rw-r--r-- | project2/xmlObjectLoader.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/project2/xmlObjectLoader.cpp b/project2/xmlObjectLoader.cpp index 849cfa1..2745d61 100644 --- a/project2/xmlObjectLoader.cpp +++ b/project2/xmlObjectLoader.cpp @@ -14,11 +14,12 @@ typedef std::map<std::string, boost::shared_ptr<ElementLoader> > ElementLoaderMa ElementLoaderMap & objLoaders() { - static ElementLoaderMap _objLoaders; - return _objLoaders; + static ElementLoaderMap * _objLoaders = new ElementLoaderMap(); + return *_objLoaders; } SimpleMessageException(LoadLibraryFailed); +SimpleMessageException(UnloadLibraryFailed); class Library : public SourceObject { public: @@ -31,7 +32,9 @@ class Library : public SourceObject { } } ~Library() { - dlclose(handle); + if (dlclose(handle)) { + throw UnloadLibraryFailed(dlerror()); + } } void loadComplete(const CommonObjects*) { } @@ -39,7 +42,14 @@ class Library : public SourceObject { void * handle; }; Storage<Library>::Objects libraries; -DECLARE_LOADER("library", Library); +class LibraryLoader : public ElementLoaderImpl<Library> { + public: + void onIteration() + { + libraries.clear(); + } +}; +DECLARE_CUSTOM_LOADER("library", LibraryLoader); LoaderBase::LoaderBase(const Glib::ustring & n, bool r) : recursive(r), |