Skip to content
Snippets Groups Projects
Commit 60105b33 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix leaks and memory hoarding in fast timers

parent 8a0926ad
Branches
Tags
No related merge requests found
......@@ -253,6 +253,12 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
bar_index < end_index;
++bar_index)
{
if (!row.mBars)
{
LL_WARNS() << "mTimerBarRows.mBars is null at index: " << bar_index << " bailing out" << LL_ENDL;
break;
}
TimerBar& bar = row.mBars[bar_index];
if (bar.mSelfStart > mouse_time_offset)
{
......@@ -426,21 +432,16 @@ void LLFastTimerView::draw()
void LLFastTimerView::onOpen(const LLSD& key)
{
mTimerBarRows.resize(NUM_FRAMES_HISTORY);
setPauseState(false);
mRecording.reset();
mRecording.appendPeriodicRecording(LLTrace::get_frame_recording());
for(std::deque<TimerBarRow>::iterator it = mTimerBarRows.begin(), end_it = mTimerBarRows.end();
it != end_it;
++it)
{
delete []it->mBars;
it->mBars = NULL;
}
}
void LLFastTimerView::onClose(bool app_quitting)
{
setVisible(FALSE);
mTimerBarRows.clear();
}
void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch)
......@@ -782,7 +783,7 @@ LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is)
stats_map_t time_stats;
stats_map_t sample_stats;
while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
while (!is.eof() && !is.fail() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
{
for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)
{
......@@ -1514,6 +1515,8 @@ void LLFastTimerView::drawBars()
{
llassert(bar_index < mTimerBarRows.size());
TimerBarRow& row = mTimerBarRows[bar_index];
if (row.mBars)
{
row.mTop = frame_bar_rect.mTop;
row.mBottom = frame_bar_rect.mBottom;
frame_bar_rect.mRight = frame_bar_rect.mLeft
......@@ -1522,6 +1525,7 @@ void LLFastTimerView::drawBars()
frame_bar_rect.translate(0, -(bar_height + vpad));
}
}
}
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
......@@ -1680,3 +1684,12 @@ S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width,
return bar_index;
}
LLFastTimerView::TimerBarRow::~TimerBarRow()
{
if (mBars != nullptr)
{
delete[] mBars;
mBars = nullptr;
}
}
......@@ -110,6 +110,7 @@ class LLFastTimerView : public LLFloater
mTop(0),
mBars(NULL)
{}
~TimerBarRow();
S32 mBottom,
mTop;
TimerBar* mBars;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment