Skip to content

Commit

Permalink
+ terminate xerces at program exit
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Mar 9, 2016
1 parent 6da5c23 commit 2e43774
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/App/Application.cpp
Expand Up @@ -922,6 +922,7 @@ void Application::destruct(void)
ScriptFactorySingleton::Destruct();
InterpreterSingleton::Destruct();
Base::Type::destruct();
ParameterManager::Terminate();
}

void Application::destructObserver(void)
Expand Down
7 changes: 7 additions & 0 deletions src/Base/Parameter.cpp
Expand Up @@ -1062,6 +1062,13 @@ void ParameterManager::Init(void)
}
}

void ParameterManager::Terminate(void)
{
StrXUTF8::terminate();
XUTF8Str::terminate();
XMLPlatformUtils::Terminate();
}

//**************************************************************************
// Document handling

Expand Down
3 changes: 1 addition & 2 deletions src/Base/Parameter.h
Expand Up @@ -218,8 +218,6 @@ class BaseExport ParameterGrp : public Base::Handled,public Base::Subject <cons
std::vector<std::pair<std::string,std::string> > GetASCIIMap(const char * sFilter = NULL) const;
//@}

static void Init(void);

friend class ParameterManager;

/// returns the name
Expand Down Expand Up @@ -278,6 +276,7 @@ class BaseExport ParameterManager : public ParameterGrp
ParameterManager();
~ParameterManager();
static void Init(void);
static void Terminate(void);

int LoadDocument(const char* sFileName);
int LoadDocument(const XERCES_CPP_NAMESPACE_QUALIFIER InputSource&);
Expand Down
9 changes: 9 additions & 0 deletions src/Base/XMLTools.cpp
Expand Up @@ -35,3 +35,12 @@ using namespace Base;
std::auto_ptr<XERCES_CPP_NAMESPACE::XMLTranscoder> StrXUTF8::transcoder;
std::auto_ptr<XERCES_CPP_NAMESPACE::XMLTranscoder> XUTF8Str::transcoder;

void StrXUTF8::terminate()
{
transcoder.reset();
}

void XUTF8Str::terminate()
{
transcoder.reset();
}
4 changes: 4 additions & 0 deletions src/Base/XMLTools.h
Expand Up @@ -114,6 +114,8 @@ public :
/// string which holds the UTF-8 form
std::string str;

static void terminate();

private :
static std::auto_ptr<XERCES_CPP_NAMESPACE::XMLTranscoder> transcoder;
// This is the local code page form of the string.
Expand Down Expand Up @@ -231,6 +233,8 @@ public :
/// Getter method
const XMLCh* unicodeForm() const;

static void terminate();

private :
std::basic_string<XMLCh> str;
static std::auto_ptr<XERCES_CPP_NAMESPACE::XMLTranscoder> transcoder;
Expand Down

0 comments on commit 2e43774

Please sign in to comment.