Visual C++ Debug Library Crash

Official forum for the Chipmunk2D Physics Library.
Post Reply
CountToInfinity
Posts: 4
Joined: Mon Jun 06, 2011 1:06 pm
Contact:

Visual C++ Debug Library Crash

Post by CountToInfinity »

I've been getting this error when I try to create a new body.
Debug Error!

Program: [path to program here]

This appliation has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
If it matters, I'm creating bodies after time stepping has begun, when a sensor is 'triggered,' using the same function I use to create them before simulation has begun. This error shows up in both MS Visual Studio and Code::Blocks.

Is this a simple error of oversight, or something critically wrong?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Visual C++ Debug Library Crash

Post by slembcke »

You got me. I remember being really frustrated with Windows for that error before. Basically that's the catch-all error that Windows logs when any program crashes from a number of problems. That is not my error message.

Try running it in the debugger, that should tell you what the actual error was and where it happened.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
CountToInfinity
Posts: 4
Joined: Mon Jun 06, 2011 1:06 pm
Contact:

Re: Visual C++ Debug Library Crash

Post by CountToInfinity »

Right now Visual Studio won't let me step into Chipmunk functions.

But the problem was somewhere after the call on the line

bodyshape = cpSpaceAddShape( space, cpPolyShapeNew(body, 4, verts, cpvzero)) ;

Where verts is an array of 4 vertexes.


Last time I was able to step though it, cpPolyShapeNew returned just fine, but somewhere cpSpaceAddShape brought up the crash. I'll continue trying figure out exactly where it stops and maybe get WinDbg working for more useful data.

EDIT: Here's a not too useful picture of the call stack.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Visual C++ Debug Library Crash

Post by slembcke »

cpPolyShapeNew() throws assertions if you pass it bad data. Was there anything in the log about a concave polygon or a bad winding?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
CountToInfinity
Posts: 4
Joined: Mon Jun 06, 2011 1:06 pm
Contact:

Re: Visual C++ Debug Library Crash

Post by CountToInfinity »

I don't think so. Looking at the locals, the value of 'verts' is the same when I create a similar body before the time step.

Here's a picture of the data right before calling the cpSpaceAddShape line. The first three are of shapes that work, the last is the one called later that crashes.

Of note may be verts, which follows the same pattern of positive and negative as the other ones.

EDIT: Splitting up the call with cpPolyShapeNew() returning to a temporary variable shows it's returning a shape similar to that of the other ones.
CountToInfinity
Posts: 4
Joined: Mon Jun 06, 2011 1:06 pm
Contact:

Re: Visual C++ Debug Library Crash

Post by CountToInfinity »

Double post because I found the problem.

To put it simply, I was calling cpSpaceAddShape() while it was stepping by sticking it in to the collision handle function.

That's all.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests