Collision Dispatcher Initialization Crash

DarkRaven
Posts: 4
Joined: Thu Sep 24, 2009 10:24 pm

Collision Dispatcher Initialization Crash

Post by DarkRaven »

Hey everyone, I've just started integrating Bulet Physics with my game engine, and I started by creating a project based on the hello world demo. The code compiles and runs fine, I even got some gravity working.

However, now I'm transferring the initialisation code into the real project, and I've encountered some problems. When I try to use this line:

Code: Select all

btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
My program crashes. However, if I actually declare a btCollisionDispatcher, not a pointer, like:

Code: Select all

btCollisionDispatcher dispatcher(collisionConfiguration);
or

Code: Select all

btCollisionDispatcher dispatcher = btCollisionDispatcher(collisionConfiguration);
The program runs perfectly well, with no trace of the crash. However, I'd prefer to use the code with the pointer, as this is how the demo does it, and it seems tidier to me. The collisionConfiguration is initialised like this:

Code: Select all

btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
I've checked the project setup, and all the libraries used in the test project are used in the game engine. The bullet includes are fine too. The only code I run before the bullet initialization code is a general Init() function, which sets up SDL, OpenGL and DevIL.

Does anyone have any ideas why this might be happening?

Thanks very much!
shogun
Posts: 34
Joined: Tue Mar 04, 2008 3:16 pm

Re: Collision Dispatcher Initialization Crash

Post by shogun »

How does it crash, and where?
What does the debugger? Stack trace?
DarkRaven
Posts: 4
Joined: Thu Sep 24, 2009 10:24 pm

Re: Collision Dispatcher Initialization Crash

Post by DarkRaven »

No debugger, I'm using codeblocks with VC++ 2008 Compiler and I can't figure out how to configure it correctly. Any help on that front would be appreciated. It lists a load of "ModLoad" commands and then tells me that:

Code: Select all

(1040.1494): Break instruction exception - code 80000003 (first chance)
eax=00261eb4 ebx=7ffde000 ecx=00000002 edx=00000004 esi=00261f48 edi=00261eb4
eip=7c90120e esp=0013fb20 ebp=0013fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!DbgBreakPoint:
7c90120e cc              int     3
Debugger finished with status 1
As for the actual crash, it seems to be some sort of access violation, but without the debugging I can't tell for sure. Also the fact that it only happens with a pointer could be something to do with memory. It crashes as soon as it hits that line - when I comment it out, everything works fine (but then I'd have no narrow phase collision testing, right?)

Thanks again!
shogun
Posts: 34
Joined: Tue Mar 04, 2008 3:16 pm

Re: Collision Dispatcher Initialization Crash

Post by shogun »

As the code itself isn't wrong, you'll have to get things straight first with your debugger ...
Why don't you just use VC++EE?
DarkRaven
Posts: 4
Joined: Thu Sep 24, 2009 10:24 pm

Re: Collision Dispatcher Initialization Crash

Post by DarkRaven »

I prefer the layout of Codeblocks, and the project is in the CodeBlocks file format. The exe will debug alright in WinDbg, but using the VC++ debugger in codeblocks I can't acheive the same results. Any suggestions?
DarkRaven
Posts: 4
Joined: Thu Sep 24, 2009 10:24 pm

Re: Collision Dispatcher Initialization Crash

Post by DarkRaven »

Hmm, I ran WinDbg on the exe and it gave me this:

Code: Select all

0:000> g
ModLoad: 5cb70000 5cb96000   C:\WINDOWS\system32\ShimEng.dll
ModLoad: 76390000 763ad000   C:\WINDOWS\system32\IMM32.DLL
ModLoad: 773d0000 774d3000   C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll
eax=000000c0 ebx=1bcefed0 ecx=00160178 edx=00000000 esi=00000000 edi=7ffd5000
eip=7c90e514 esp=1bcefea8 ebp=1bceff44 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
ntdll!KiFastSystemCallRet:
7c90e514 c3              ret
0:001> g
       ^ No runnable debuggees error in 'g'
I don't really know how to use a debugger, so if anyone could explain or point to a good tutorial I'd really appreciate it... eg. whether to use Go, Step Into, Step Out...