Fix calls to CXeromyces::Terminate in the main loop to fix several possible memory leaks.
Make init/shutdown order consistent in some places. This was SVN commit r18589.
This commit is contained in:
parent
162535c7b7
commit
e3cdb2253d
@ -423,15 +423,6 @@ static void RunGameOrAtlas(int argc, const char* argv[])
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to initialize libxml2 and SpiderMonkey in the main thread before
|
||||
// any thread uses them. So initialize them here before we might run Atlas.
|
||||
CXeromyces::Startup();
|
||||
ScriptEngine scriptEngine;
|
||||
|
||||
// Atlas handles the whole init/shutdown/etc sequence by itself;
|
||||
if (ATLAS_RunIfOnCmdLine(args, false))
|
||||
return;
|
||||
|
||||
const bool isReplay = args.Has("replay");
|
||||
const bool isVisualReplay = args.Has("replay-visual");
|
||||
const std::string replayFile = isReplay ? args.Get("replay") : (isVisualReplay ? args.Get("replay-visual") : "");
|
||||
@ -451,6 +442,17 @@ static void RunGameOrAtlas(int argc, const char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// We need to initialize SpiderMonkey and libxml2 in the main thread before
|
||||
// any thread uses them. So initialize them here before we might run Atlas.
|
||||
ScriptEngine scriptEngine;
|
||||
CXeromyces::Startup();
|
||||
|
||||
if (ATLAS_RunIfOnCmdLine(args, false))
|
||||
{
|
||||
CXeromyces::Terminate();
|
||||
return;
|
||||
}
|
||||
|
||||
// run non-visual simulation replay if requested
|
||||
if (isReplay)
|
||||
{
|
||||
@ -460,6 +462,7 @@ static void RunGameOrAtlas(int argc, const char* argv[])
|
||||
CXeromyces::Terminate();
|
||||
return;
|
||||
}
|
||||
|
||||
Paths paths(args);
|
||||
g_VFS = CreateVfs(20 * MiB);
|
||||
g_VFS->Mount(L"cache/", paths.Cache(), VFS_MOUNT_ARCHIVABLE);
|
||||
@ -528,12 +531,8 @@ static void RunGameOrAtlas(int argc, const char* argv[])
|
||||
} while (restart);
|
||||
|
||||
if (restart_in_atlas)
|
||||
{
|
||||
ATLAS_RunIfOnCmdLine(args, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Shut down libxml2 (done here to match the Startup call)
|
||||
CXeromyces::Terminate();
|
||||
}
|
||||
|
||||
|
@ -48,10 +48,8 @@ public:
|
||||
void tearDown()
|
||||
{
|
||||
delete &g_TexMan;
|
||||
|
||||
g_VFS.reset();
|
||||
|
||||
CXeromyces::Terminate();
|
||||
g_VFS.reset();
|
||||
}
|
||||
|
||||
void test_namespace()
|
||||
|
Loading…
Reference in New Issue
Block a user