using 'setInternalGhostPairCallback' cause bullet to crash in multi thread mode

Post Reply
somboon
Posts: 4
Joined: Thu May 30, 2013 3:43 am

using 'setInternalGhostPairCallback' cause bullet to crash in multi thread mode

Post by somboon »

I've tried using bullet in multi thread mode (using exactly the same initialize sequence suggest in the topic).

It work great with almost 2x performance boost.

but since my program required use of character controller and ghost object,I have to call setInternalGhostPairCallback.

this cause bullet to crash with access violation. in function

Code: Select all

void btCollisionDispatcherMt::releaseManifold(btPersistentManifold* manifold)
{
	clearManifold(manifold);
	//btAssert( !btThreadsAreRunning() );
	if (!m_batchUpdating)
	{
		// batch updater will update manifold pointers array after finishing, so
		// only need to update array when not batch-updating
		int findIndex = manifold->m_index1a;
		btAssert(findIndex < m_manifoldsPtr.size());
		m_manifoldsPtr.swap(findIndex, m_manifoldsPtr.size() - 1);
		m_manifoldsPtr[findIndex]->m_index1a = findIndex;
		m_manifoldsPtr.pop_back();
	}

	manifold->~btPersistentManifold();
	if (m_persistentManifoldPoolAllocator->validPtr(manifold))
	{
		m_persistentManifoldPoolAllocator->freeMemory(manifold);
	}
	else
	{
		btAlignedFree(manifold);
	}
Remove the setInternalGhostPairCallback stop the crashed but make character fall throught the ground since it need ghost object.

The Bullet I am using is version 2.89 compile with BT_THREADSAFE.
Character controller used are the reference one included with the source of 2.89
somboon
Posts: 4
Joined: Thu May 30, 2013 3:43 am

Re: using 'setInternalGhostPairCallback' cause bullet to crash in multi thread mode

Post by somboon »

I have tried using bullet version 3.17 (compile with multithreaded OpenMP/PPL/win32) and the result are the same.
It work as long as I dont use ghostpaircallback.
But when I registered the callback, It alway crashed in releaseManifold Function even when no ghost object are add to dynamic world.
Post Reply