blob: a144ac6d9330e8a0c57e423616054bfc7b803ca5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/**
* @file llmortician.cpp
*
* Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
* $License$
*/
#include "llmortician.h"
#include <list>
std::list<LLMortician*> gGraveyard;
BOOL LLMortician::sDestroyImmediate = FALSE;
LLMortician::~LLMortician()
{
gGraveyard.remove(this);
}
void LLMortician::updateClass()
{
while (!gGraveyard.empty())
{
LLMortician* dead = gGraveyard.front();
delete dead;
}
}
void LLMortician::die()
{
// It is valid to call die() more than once on something that hasn't died yet
if (sDestroyImmediate)
{
// *NOTE: This is a hack to ensure destruction order on shutdown.
mIsDead = TRUE;
delete this;
return;
}
else if (!mIsDead)
{
mIsDead = TRUE;
gGraveyard.push_back(this);
}
}
// static
void LLMortician::setZealous(BOOL b)
{
sDestroyImmediate = b;
}
|