Remove RobotLogging from CMakeLists.txt

Avoid crashing if threadIndex exceeds BT_QUICKPROF_MAX_THREAD_COUNT (64)
This commit is contained in:
Erwin Coumans
2017-03-23 18:00:00 -07:00
parent 21d1827c9f
commit ee0e3ba271
2 changed files with 5 additions and 5 deletions

View File

@@ -518,7 +518,7 @@ CProfileIterator * CProfileManager::Get_Iterator( void )
{ {
int threadIndex = btQuickprofGetCurrentThreadIndex2(); int threadIndex = btQuickprofGetCurrentThreadIndex2();
if (threadIndex<0) if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT)
return 0; return 0;
return new CProfileIterator( &gRoots[threadIndex]); return new CProfileIterator( &gRoots[threadIndex]);
@@ -549,7 +549,7 @@ void CProfileManager::CleanupMemory(void)
void CProfileManager::Start_Profile( const char * name ) void CProfileManager::Start_Profile( const char * name )
{ {
int threadIndex = btQuickprofGetCurrentThreadIndex2(); int threadIndex = btQuickprofGetCurrentThreadIndex2();
if (threadIndex<0) if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT)
return; return;
if (name != gCurrentNodes[threadIndex]->Get_Name()) { if (name != gCurrentNodes[threadIndex]->Get_Name()) {
@@ -566,7 +566,7 @@ void CProfileManager::Start_Profile( const char * name )
void CProfileManager::Stop_Profile( void ) void CProfileManager::Stop_Profile( void )
{ {
int threadIndex = btQuickprofGetCurrentThreadIndex2(); int threadIndex = btQuickprofGetCurrentThreadIndex2();
if (threadIndex<0) if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT)
return; return;
// Return will indicate whether we should back up to our parent (we may // Return will indicate whether we should back up to our parent (we may
@@ -590,7 +590,7 @@ void CProfileManager::Reset( void )
{ {
gProfileClock.reset(); gProfileClock.reset();
int threadIndex = btQuickprofGetCurrentThreadIndex2(); int threadIndex = btQuickprofGetCurrentThreadIndex2();
if (threadIndex<0) if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT)
return; return;
gRoots[threadIndex].Reset(); gRoots[threadIndex].Reset();
gRoots[threadIndex].Call(); gRoots[threadIndex].Call();

View File

@@ -3,5 +3,5 @@ IF(BUILD_BULLET3)
SUBDIRS( InverseDynamics SharedMemory ) SUBDIRS( InverseDynamics SharedMemory )
ENDIF(BUILD_BULLET3) ENDIF(BUILD_BULLET3)
SUBDIRS( gtest-1.7.0 collision RobotLogging BulletDynamics ) SUBDIRS( gtest-1.7.0 collision BulletDynamics )