Access violation while stepping the simulation - Ogre3D

Post Reply
Jacob843
Posts: 3
Joined: Mon Aug 11, 2014 6:31 pm

Access violation while stepping the simulation - Ogre3D

Post by Jacob843 »

Hello! I am working with Bullet 2.83 and Ogre3D v1.9. I have been following a guide for my project. Most of the code that you should look at are in:
Upon runtime, and calling "stepSimulation", as seen in

Code: Select all

dynamicsWorld->stepSimulation(btScalar(1.)/btScalar(60.), btScalar(1.)/btScalar(60.)); //60fps
[/url]
I receive an access violation. I have used Visual Studio to track down a more specific area. The function "updateSingleAabb" is called sometime during the stepSimulation. The actual crash occurs with this line:

Code: Select all

colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
I read a forum post of a similar issue, but the poster didn't elaborate on the solution. Regardless, I attempted to fix it myself by having a vector of btRigidBodies to call upon, but alas, no dice.

The word for word error is:

Code: Select all

Unhandled exception at 0x00E8BFAC in Universe.exe: 0xC0000005: Access violation reading location 0xFDFDFDFD.
and my callstack is as follows:

Code: Select all

>	Universe.exe!btCollisionWorld::updateSingleAabb(btCollisionObject * colObj) Line 150	C++
 	Universe.exe!btCollisionWorld::updateAabbs() Line 204	C++
 	Universe.exe!btCollisionWorld::performDiscreteCollisionDetection() Line 220	C++
 	Universe.exe!btDiscreteDynamicsWorld::internalSingleStepSimulation(float timeStep) Line 492	C++
 	Universe.exe!btDiscreteDynamicsWorld::stepSimulation(float timeStep, int maxSubSteps, float fixedTimeStep) Line 452	C++
 	Universe.exe!Physics::Prop::frameStarted(const Ogre::FrameEvent & evt) Line 142	C++
 	Universe.exe!FrameListener::frameStarted(const Ogre::FrameEvent & evt) Line 243	C++
 	OgreMain_d.dll!10613c97()	Unknown
 	[Frames below may be incorrect and/or missing, no symbols loaded for OgreMain_d.dll]	
 	OgreMain_d.dll!10614047()	Unknown
 	OgreMain_d.dll!106120d6()	Unknown
 	Universe.exe!Video::Render() Line 231	C++
 	Universe.exe!sf::priv::ThreadMemberFunc<Video>::run() Line 58	C++
 	Universe.exe!sf::Thread::run(void)	Unknown
 	Universe.exe!sf::priv::ThreadImpl::entryPoint(void *)	Unknown
 	msvcr110d.dll!_callthreadstartex() Line 354	C
 	msvcr110d.dll!_threadstartex(void * ptd) Line 337	C
 	kernel32.dll!7562338a()	Unknown
 	ntdll.dll!___RtlUserThreadStart@8()	Unknown
 	ntdll.dll!__RtlUserThreadStart@8()	Unknown
Any help would be greatly appreciated.

Cheers,
Jacob
c6burns
Posts: 149
Joined: Fri May 24, 2013 6:08 am

Re: Access violation while stepping the simulation - Ogre3D

Post by c6burns »

0xFDFDFDFD : Used by Microsoft's C++ debugging heap to mark "no man's land" guard bytes before and after allocated heap memory
Double check all your allocs / deallocs ... also you could put a break point on that pointer before it got corrupted and see exactly where it is being changed.
Jacob843
Posts: 3
Joined: Mon Aug 11, 2014 6:31 pm

Re: Access violation while stepping the simulation - Ogre3D

Post by Jacob843 »

c6burns wrote:
0xFDFDFDFD : Used by Microsoft's C++ debugging heap to mark "no man's land" guard bytes before and after allocated heap memory
Double check all your allocs / deallocs ... also you could put a break point on that pointer before it got corrupted and see exactly where it is being changed.
Sorry if I am misunderstanding you, but what pointer are you referring to? I will do some more testing and see what I can find.

So I did some more testing and I see that colObj's m_rootCollisionShape is NULL. "userPointer" is part of that, which could be an issue. Can somebody confirm this?
Jacob843
Posts: 3
Joined: Mon Aug 11, 2014 6:31 pm

Re: Access violation while stepping the simulation - Ogre3D

Post by Jacob843 »

Right. It seems to have been because there was a MESS of pointers within the vector.

Fixed as of commit 400dba51
Post Reply