diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 239d1621010154363f144ac01ba00ba0d7bf82fe..995f4680a3123c1d0b7c43c65f607b94ab79fc50 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -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,13 +1515,16 @@ void LLFastTimerView::drawBars() { llassert(bar_index < mTimerBarRows.size()); TimerBarRow& row = mTimerBarRows[bar_index]; - row.mTop = frame_bar_rect.mTop; - row.mBottom = frame_bar_rect.mBottom; - frame_bar_rect.mRight = frame_bar_rect.mLeft - + ll_round((row.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()); - drawBar(frame_bar_rect, row, image_width, image_height); + if (row.mBars) + { + row.mTop = frame_bar_rect.mTop; + row.mBottom = frame_bar_rect.mBottom; + frame_bar_rect.mRight = frame_bar_rect.mLeft + + ll_round((row.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()); + drawBar(frame_bar_rect, row, image_width, image_height); - frame_bar_rect.translate(0, -(bar_height + vpad)); + frame_bar_rect.translate(0, -(bar_height + vpad)); + } } } @@ -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; + } +} diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index ff65f8da079988aaea6b2b6e4fbb15cba0a5c4eb..6ce0ecea52d86f164e8e9c9577bae90c81e56aac 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -110,6 +110,7 @@ class LLFastTimerView : public LLFloater mTop(0), mBars(NULL) {} + ~TimerBarRow(); S32 mBottom, mTop; TimerBar* mBars;