Commit adb7d451 authored by loring's avatar loring
Browse files

fix a small leak, make sure that the global instance of

the QueryFactory is deallocated when the program exits.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23268 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3065ed7d
......@@ -121,8 +121,14 @@ using namespace StringHelpers;
// Storage for static data elements.
//
avtQueryFactory *avtQueryFactory::instance=0;
void avtQueryFactory::DeleteInstance()
{
if (instance)
{
delete instance;
instance = 0;
}
}
// ****************************************************************************
// Method: avtQueryFactory constructor
......@@ -166,6 +172,12 @@ avtQueryFactory::~avtQueryFactory()
// Programmer: Kathleen Bonnell
// Creation: March 30, 2004
//
// Modifications:
//
// Burlen Loring, Thu May 1 17:55:28 PDT 2014
// don't leak the instance, following the pattern of using
// exit handler established by David Camp
//
// ****************************************************************************
avtQueryFactory *
......@@ -177,8 +189,10 @@ avtQueryFactory::Instance()
if (instance == 0)
{
instance = new avtQueryFactory;
#if defined(DEBUG_MEMORY_LEAKS)
atexit(avtQueryFactory::DeleteInstance);
#endif
}
return instance;
}
......
......@@ -75,6 +75,7 @@ class QUERY_API avtQueryFactory
private:
avtQueryFactory();
static void DeleteInstance();
static avtQueryFactory *instance;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment