summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstat.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-08-25 12:49:40 -0700
committerRichard Linden <none@none>2012-08-25 12:49:40 -0700
commitcc7043ecf6b58e7d5a38167b5f507abc6b0b70b1 (patch)
tree877f2311b9cfca51ca46771fa4cba6b415fa48e1 /indra/llcommon/llstat.cpp
parentc8a36e9cfd1e90a1aa385667c7272c25e2ef9136 (diff)
fixed crash on startup
Diffstat (limited to 'indra/llcommon/llstat.cpp')
-rw-r--r--indra/llcommon/llstat.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp
index 2c91e10404..d265d77a4d 100644
--- a/indra/llcommon/llstat.cpp
+++ b/indra/llcommon/llstat.cpp
@@ -37,7 +37,8 @@
// statics
-LLStat::stat_map_t LLStat::sStatList;
+
+
//------------------------------------------------------------------------
LLTimer LLStat::sTimer;
LLFrameTimer LLStat::sFrameTimer;
@@ -55,7 +56,8 @@ void LLStat::reset()
LLStat::LLStat(std::string name, S32 num_bins, BOOL use_frame_timer)
: mUseFrameTimer(use_frame_timer),
mNumBins(num_bins),
- mName(name)
+ mName(name),
+ mBins(NULL)
{
llassert(mNumBins > 0);
mLastTime = 0.f;
@@ -64,13 +66,20 @@ LLStat::LLStat(std::string name, S32 num_bins, BOOL use_frame_timer)
if (!mName.empty())
{
- stat_map_t::iterator iter = sStatList.find(mName);
- if (iter != sStatList.end())
+ stat_map_t::iterator iter = getStatList().find(mName);
+ if (iter != getStatList().end())
llwarns << "LLStat with duplicate name: " << mName << llendl;
- sStatList.insert(std::make_pair(mName, this));
+ getStatList().insert(std::make_pair(mName, this));
}
}
+LLStat::stat_map_t& LLStat::getStatList()
+{
+ static LLStat::stat_map_t stat_list;
+ return stat_list;
+}
+
+
LLStat::~LLStat()
{
delete[] mBins;
@@ -78,10 +87,10 @@ LLStat::~LLStat()
if (!mName.empty())
{
// handle multiple entries with the same name
- stat_map_t::iterator iter = sStatList.find(mName);
- while (iter != sStatList.end() && iter->second != this)
+ stat_map_t::iterator iter = getStatList().find(mName);
+ while (iter != getStatList().end() && iter->second != this)
++iter;
- sStatList.erase(iter);
+ getStatList().erase(iter);
}
}