BugSplat Crash #1504587: std::vector::empty()

master
Alexander Gavriliuk 2024-08-15 17:46:58 +02:00 committed by Guru
parent 3ca4bb6bf7
commit 10ef293bc9
1 changed files with 22 additions and 23 deletions

View File

@ -159,7 +159,8 @@ AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* record
ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate( AccumulatorBufferGroup* recording ) ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate( AccumulatorBufferGroup* recording )
{ {
#if LL_TRACE_ENABLED #if LL_TRACE_ENABLED
if (mActiveRecordings.empty()) return mActiveRecordings.end(); if (mActiveRecordings.empty())
return mActiveRecordings.end();
mActiveRecordings.back()->mPartialRecording.sync(); mActiveRecordings.back()->mPartialRecording.sync();
BlockTimer::updateTimes(); BlockTimer::updateTimes();
@ -202,7 +203,7 @@ ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate(
#endif #endif
} }
void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording ) void ThreadRecorder::deactivate(AccumulatorBufferGroup* recording)
{ {
#if LL_TRACE_ENABLED #if LL_TRACE_ENABLED
active_recording_list_t::iterator recording_it = bringUpToDate(recording); active_recording_list_t::iterator recording_it = bringUpToDate(recording);
@ -228,9 +229,10 @@ void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording )
#endif #endif
} }
ThreadRecorder::ActiveRecording::ActiveRecording( AccumulatorBufferGroup* target ) ThreadRecorder::ActiveRecording::ActiveRecording(AccumulatorBufferGroup* target)
: mTargetRecording(target) : mTargetRecording(target)
{} {
}
void ThreadRecorder::ActiveRecording::movePartialToTarget() void ThreadRecorder::ActiveRecording::movePartialToTarget()
{ {
@ -243,30 +245,30 @@ void ThreadRecorder::ActiveRecording::movePartialToTarget()
// called by child thread // called by child thread
void ThreadRecorder::addChildRecorder( class ThreadRecorder* child ) void ThreadRecorder::addChildRecorder(ThreadRecorder* child)
{ {
#if LL_TRACE_ENABLED #if LL_TRACE_ENABLED
{ LLMutexLock lock(&mChildListMutex); LLMutexLock lock(&mChildListMutex);
mChildThreadRecorders.push_back(child); mChildThreadRecorders.push_back(child);
}
#endif #endif
} }
// called by child thread // called by child thread
void ThreadRecorder::removeChildRecorder( class ThreadRecorder* child ) void ThreadRecorder::removeChildRecorder(ThreadRecorder* child)
{ {
#if LL_TRACE_ENABLED #if LL_TRACE_ENABLED
{ LLMutexLock lock(&mChildListMutex); LLMutexLock lock(&mChildListMutex);
mChildThreadRecorders.remove(child); mChildThreadRecorders.remove(child);
}
#endif #endif
} }
void ThreadRecorder::pushToParent() void ThreadRecorder::pushToParent()
{ {
#if LL_TRACE_ENABLED #if LL_TRACE_ENABLED
{ LLMutexLock lock(&mSharedRecordingMutex); if (ThreadRecorder* recorder = LLTrace::get_thread_recorder())
LLTrace::get_thread_recorder()->bringUpToDate(&mThreadRecordingBuffers); {
LLMutexLock lock(&mSharedRecordingMutex);
recorder->bringUpToDate(&mThreadRecordingBuffers);
mSharedRecordingBuffers.append(mThreadRecordingBuffers); mSharedRecordingBuffers.append(mThreadRecordingBuffers);
mThreadRecordingBuffers.reset(); mThreadRecordingBuffers.reset();
} }
@ -278,15 +280,14 @@ void ThreadRecorder::pullFromChildren()
{ {
#if LL_TRACE_ENABLED #if LL_TRACE_ENABLED
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
if (mActiveRecordings.empty()) return; if (!mActiveRecordings.empty())
{
{ LLMutexLock lock(&mChildListMutex); LLMutexLock lock(&mChildListMutex);
AccumulatorBufferGroup& target_recording_buffers = mActiveRecordings.back()->mPartialRecording; AccumulatorBufferGroup& target_recording_buffers = mActiveRecordings.back()->mPartialRecording;
target_recording_buffers.sync(); target_recording_buffers.sync();
for (LLTrace::ThreadRecorder* rec : mChildThreadRecorders) for (LLTrace::ThreadRecorder* rec : mChildThreadRecorders)
{ LLMutexLock lock(&(rec->mSharedRecordingMutex)); {
LLMutexLock lock(&(rec->mSharedRecordingMutex));
target_recording_buffers.merge(rec->mSharedRecordingBuffers); target_recording_buffers.merge(rec->mSharedRecordingBuffers);
rec->mSharedRecordingBuffers.reset(); rec->mSharedRecordingBuffers.reset();
} }
@ -294,13 +295,11 @@ void ThreadRecorder::pullFromChildren()
#endif #endif
} }
void set_master_thread_recorder(ThreadRecorder* recorder)
void set_master_thread_recorder( ThreadRecorder* recorder )
{ {
sMasterThreadRecorder = recorder; sMasterThreadRecorder = recorder;
} }
ThreadRecorder* get_master_thread_recorder() ThreadRecorder* get_master_thread_recorder()
{ {
return sMasterThreadRecorder; return sMasterThreadRecorder;