llmortician.cpp

Go to the documentation of this file.
00001 
00031 #include "linden_common.h"
00032 #include "llmortician.h"
00033 
00034 #include <list>
00035 
00036 std::list<LLMortician*> gGraveyard;
00037 
00038 BOOL LLMortician::sDestroyImmediate = FALSE;
00039 
00040 LLMortician::~LLMortician() 
00041 {
00042         gGraveyard.remove(this);
00043 }
00044 
00045 void LLMortician::updateClass() 
00046 {
00047         while (!gGraveyard.empty()) 
00048         {
00049                 LLMortician* dead = gGraveyard.front();
00050                 delete dead;
00051         }
00052 }
00053 
00054 void LLMortician::die() 
00055 {
00056         // It is valid to call die() more than once on something that hasn't died yet
00057         if (sDestroyImmediate)
00058         {
00059                 // *NOTE: This is a hack to ensure destruction order on shutdown.
00060                 mIsDead = TRUE;
00061                 delete this;
00062                 return;
00063         }
00064         else if (!mIsDead)
00065         {
00066                 mIsDead = TRUE;
00067                 gGraveyard.push_back(this);
00068         }
00069 }
00070 
00071 // static
00072 void LLMortician::setZealous(BOOL b)
00073 {
00074         sDestroyImmediate = b;
00075 }

Generated on Thu Jul 1 06:08:54 2010 for Second Life Viewer by  doxygen 1.4.7