Wrap main loop with try, not wrap try with main loop.

This commit is contained in:
Lirusaito
2019-03-09 17:25:12 -05:00
parent 7acce90927
commit d2983deb48

View File

@@ -1163,6 +1163,8 @@ bool LLAppViewer::mainLoop()
BOOL restore_rendering_masks = FALSE; BOOL restore_rendering_masks = FALSE;
// Handle messages // Handle messages
try
{
while (!LLApp::isExiting()) while (!LLApp::isExiting())
{ {
LLFastTimer::nextFrame(); // Should be outside of any timer instances LLFastTimer::nextFrame(); // Should be outside of any timer instances
@@ -1173,8 +1175,6 @@ bool LLAppViewer::mainLoop()
//check memory availability information //check memory availability information
checkMemory() ; checkMemory() ;
try
{
// Check if we need to restore rendering masks. // Check if we need to restore rendering masks.
if (restore_rendering_masks) if (restore_rendering_masks)
{ {
@@ -1227,9 +1227,7 @@ bool LLAppViewer::mainLoop()
#endif #endif
//memory leaking simulation //memory leaking simulation
LLFloaterMemLeak* mem_leak_instance = if (auto mem_leak_instance = LLFloaterMemLeak::getInstance())
LLFloaterMemLeak::getInstance();
if(mem_leak_instance)
{ {
mem_leak_instance->idle(); mem_leak_instance->idle();
} }
@@ -1414,55 +1412,30 @@ bool LLAppViewer::mainLoop()
// LLAppViewer::getTextureFetch()->pause(); // Don't pause the fetch (IO) thread // LLAppViewer::getTextureFetch()->pause(); // Don't pause the fetch (IO) thread
} }
//LLVFSThread::sLocal->pause(); // Prevent the VFS thread from running while rendering. //LLVFSThread::sLocal->pause(); // Prevent the VFS thread from running while rendering.
//LLLFSThread::sLocal->pause(); // Prevent the LFS thread from running while rendering.
resumeMainloopTimeout(); resumeMainloopTimeout();
pingMainloopTimeout("Main:End"); pingMainloopTimeout("Main:End");
} }
} }
// Save snapshot for next time, if we made it through initialization
if (STATE_STARTED == LLStartUp::getStartupState())
saveFinalSnapshot();
}
catch(std::bad_alloc) catch(std::bad_alloc)
{ {
LLMemory::logMemoryInfo(TRUE); LLMemory::logMemoryInfo(TRUE);
//stop memory leaking simulation //stop memory leaking simulation
LLFloaterMemLeak* mem_leak_instance = if (auto mem_leak_instance = LLFloaterMemLeak::getInstance())
LLFloaterMemLeak::getInstance();
if(mem_leak_instance)
{
mem_leak_instance->stop(); mem_leak_instance->stop();
LL_WARNS() << "Bad memory allocation in LLAppViewer::mainLoop()!" << LL_ENDL ;
}
else
{
//output possible call stacks to log file. //output possible call stacks to log file.
LLError::LLCallStacks::print(); LLError::LLCallStacks::print();
LL_ERRS() << "Bad memory allocation in LLAppViewer::mainLoop()!" << LL_ENDL; LL_ERRS() << "Bad memory allocation in LLAppViewer::mainLoop()!" << LL_ENDL;
} }
}
}
// Save snapshot for next time, if we made it through initialization
if (STATE_STARTED == LLStartUp::getStartupState())
{
try
{
saveFinalSnapshot();
}
catch(std::bad_alloc)
{
LL_WARNS() << "Bad memory allocation when saveFinalSnapshot() is called!" << LL_ENDL ;
//stop memory leaking simulation
LLFloaterMemLeak* mem_leak_instance =
LLFloaterMemLeak::getInstance();
if(mem_leak_instance)
{
mem_leak_instance->stop() ;
}
}
}
delete gServicePump; delete gServicePump;