Wrap main loop with try, not wrap try with main loop.
This commit is contained in:
@@ -1163,18 +1163,18 @@ bool LLAppViewer::mainLoop()
|
|||||||
BOOL restore_rendering_masks = FALSE;
|
BOOL restore_rendering_masks = FALSE;
|
||||||
|
|
||||||
// Handle messages
|
// Handle messages
|
||||||
while (!LLApp::isExiting())
|
try
|
||||||
{
|
{
|
||||||
LLFastTimer::nextFrame(); // Should be outside of any timer instances
|
while (!LLApp::isExiting())
|
||||||
|
|
||||||
//clear call stack records
|
|
||||||
LL_CLEAR_CALLSTACKS();
|
|
||||||
|
|
||||||
//check memory availability information
|
|
||||||
checkMemory() ;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
|
LLFastTimer::nextFrame(); // Should be outside of any timer instances
|
||||||
|
|
||||||
|
//clear call stack records
|
||||||
|
LL_CLEAR_CALLSTACKS();
|
||||||
|
|
||||||
|
//check memory availability information
|
||||||
|
checkMemory() ;
|
||||||
|
|
||||||
// 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,11 +1227,9 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
// canonical per-frame event
|
// canonical per-frame event
|
||||||
@@ -1414,54 +1412,29 @@ 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(std::bad_alloc)
|
|
||||||
{
|
|
||||||
LLMemory::logMemoryInfo(TRUE) ;
|
|
||||||
|
|
||||||
//stop memory leaking simulation
|
// Save snapshot for next time, if we made it through initialization
|
||||||
LLFloaterMemLeak* mem_leak_instance =
|
if (STATE_STARTED == LLStartUp::getStartupState())
|
||||||
LLFloaterMemLeak::getInstance();
|
|
||||||
if(mem_leak_instance)
|
|
||||||
{
|
|
||||||
mem_leak_instance->stop() ;
|
|
||||||
LL_WARNS() << "Bad memory allocation in LLAppViewer::mainLoop()!" << LL_ENDL ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//output possible call stacks to log file.
|
|
||||||
LLError::LLCallStacks::print() ;
|
|
||||||
|
|
||||||
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();
|
saveFinalSnapshot();
|
||||||
}
|
}
|
||||||
catch(std::bad_alloc)
|
catch(std::bad_alloc)
|
||||||
{
|
{
|
||||||
LL_WARNS() << "Bad memory allocation when saveFinalSnapshot() is called!" << LL_ENDL ;
|
LLMemory::logMemoryInfo(TRUE);
|
||||||
|
|
||||||
//stop memory leaking simulation
|
//stop memory leaking simulation
|
||||||
LLFloaterMemLeak* mem_leak_instance =
|
if (auto mem_leak_instance = LLFloaterMemLeak::getInstance())
|
||||||
LLFloaterMemLeak::getInstance();
|
mem_leak_instance->stop();
|
||||||
if(mem_leak_instance)
|
|
||||||
{
|
//output possible call stacks to log file.
|
||||||
mem_leak_instance->stop() ;
|
LLError::LLCallStacks::print();
|
||||||
}
|
|
||||||
}
|
LL_ERRS() << "Bad memory allocation in LLAppViewer::mainLoop()!" << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete gServicePump;
|
delete gServicePump;
|
||||||
|
|||||||
Reference in New Issue
Block a user