Crash on NewtonUpdate and SetWorld Size

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Crash on NewtonUpdate and SetWorld Size

Postby Julio Jerez » Tue Jun 22, 2010 6:33 pm

The back trace saye that it crash calling a callback
dgWorld::CalculateContacts() 0x00007ffff64fe163

calculate contact call the contact process callback and if you have a bogus pointer to a funtion,
then will will not tell you what happened after that because it never made the call, so the stack mislead the debugger.

try not setting any contact prossess callback and see if work, and if it does that you know what the error is.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash on NewtonUpdate and SetWorld Size

Postby SFCBias » Tue Jun 22, 2010 6:54 pm

The virtual error was coming from the SetWorldSize. But i commented out the NewtonReleaseCollision Function and it worked, however I need to call this at some point dont I
SFCBias
 
Posts: 54
Joined: Tue Jun 22, 2010 12:40 am
Location: Hephzibah,GA

Re: Crash on NewtonUpdate and SetWorld Size

Postby Julio Jerez » Tue Jun 22, 2010 7:25 pm

The thing is that you get me all confused, you are talking of wan funtiuon an dthe you switch to something elese in the same post.
Neithr function are wrong, there must be a worng input.

one thing at a time.
did you do what I said in the previus post? if you so, did you find out what caused the crash?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash on NewtonUpdate and SetWorld Size

Postby SFCBias » Tue Jun 22, 2010 7:58 pm

Ok sorry about that.

The problem regarding the call to NewtonSetWorldSize is solved.

The problem regarding the call to NewtonUpdate was solved by commenting out the call to NewtonReleaseCollision in the createRigidBody function. So now im faced with releasing the memory from the collisions.
SFCBias
 
Posts: 54
Joined: Tue Jun 22, 2010 12:40 am
Location: Hephzibah,GA

Re: Crash on NewtonUpdate and SetWorld Size

Postby Julio Jerez » Tue Jun 22, 2010 8:19 pm

on this NewtonReleaseCollision you are releasing one too many time, you can find out the RefCount of a shape but diing this

Code: Select all
int ref = NewtonAddCollisionReference(shape) - 1;
NewtonReleaseCollision ( newtonWorld, shape);


for most shapes when created the ref count is 2 (one for the world caching and one for creation) or 1 for non cached shapes.
when you asign then to a body RefCount increases, Releasing decremented the ref count,
and if the last value is one and is own by the worl or, if is is zero, then it will go away.,
Releasing it more than it was increased will leave a dangling pointer (a guarantee crash).

I really do not like reference counting, but is is cheap.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash on NewtonUpdate and SetWorld Size

Postby SFCBias » Tue Jun 22, 2010 9:36 pm

Thank you i found the problem. I was calling NewtonReleaseCollision at the end of the createRigidbody function but also in the function that created the collision. Now everything is going smoothly.
SFCBias
 
Posts: 54
Joined: Tue Jun 22, 2010 12:40 am
Location: Hephzibah,GA

Previous

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 13 guests