m_MasterNode Assert

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

m_MasterNode Assert

Postby FSA » Thu Aug 28, 2014 9:50 am

I've updated the newton source in my project. Now im getting an assert when I want to scale a body. Scale values are valid (>0).

Callstack:
Code: Select all
>   newton_d.dll!dgBody::SetMassMatrix(float mass, float Ixx, float Iyy, float Izz)  Line 468 + 0x31 bytes   C++
    newton_d.dll!dgBody::SetMassProperties(float mass, const dgCollisionInstance * const collision)  Line 551   C++
    newton_d.dll!NewtonBodySetMassProperties(const NewtonBody * const bodyPtr, float mass, const NewtonCollision * const collisionPtr)  Line 4776   C++
    newton_d.dll!NewtonBodySetCollisionScale(const NewtonBody * const bodyPtr, float scaleX, float scaleY, float scaleZ)  Line 5525 + 0x24 bytes   C++
    NoxetEngineD.dll!NoxetEngine::PhysicBody::SetScaling(const NoxetEngine::Vector3 & vScaling)  Line 57 + 0x6c bytes   C++
    Editor.exe!AddOnSceneHandler::UpdateGizmoBodies(const float & scaleGizmo, const NoxetEngine::Vector3 & gizmoPos)  Line 1945 + 0x2b bytes   C++
    Editor.exe!RenderWindow::RenderCheckArrows(wxDC & dc)  Line 2584   C++
    Editor.exe!RenderWindow::Render(wxDC & dc, float fTime)  Line 2958   C++
    Editor.exe!RenderWindow::PaintNow(float fTime)  Line 494   C++
    Editor.exe!NXEApp::OnIdle(wxIdleEvent & evt)  Line 380   C++
    ...


Whats wrong?
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: m_MasterNode Assert

Postby Julio Jerez » Thu Aug 28, 2014 3:14 pm

did you updated from githup? Newton 3.13
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: m_MasterNode Assert

Postby FSA » Thu Aug 28, 2014 3:25 pm

Yes I did.
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: m_MasterNode Assert

Postby Julio Jerez » Thu Aug 28, 2014 8:06 pm

that look like a really bad bug.
the code is this

Code: Select all
void dgBody::SetMassMatrix(dgFloat32 mass, dgFloat32 Ixx, dgFloat32 Iyy, dgFloat32 Izz)
{
   mass = dgAbsf (mass);
   if (m_collision->IsType(dgCollision::dgCollisionMesh_RTTI) || m_collision->IsType(dgCollision::dgCollisionScene_RTTI)) {
      mass = DG_INFINITE_MASS * 2.0f;
   }

   if (mass < dgFloat32 (1.0e-3f)) {
      mass = DG_INFINITE_MASS * 2.0f;
   }

   dgAssert (m_masterNode);


That line mean you are trying to do stuff on a body that was deleted. I have never seem that happens. No body will have a NULL pointer for master node unless it was destroyed.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: m_MasterNode Assert

Postby FSA » Fri Aug 29, 2014 6:38 am

NewtonBodySetMatrix works like a charm with the same body. The next line NewtonBodySetCollisionScale crashes. Pointers are all valid (see picture). If I comment out the scaling part everthing works as normal.
Attachments
pointer.JPG
pointer.JPG (216.28 KiB) Viewed 4251 times
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: m_MasterNode Assert

Postby Julio Jerez » Fri Aug 29, 2014 11:57 am

can you build and run the demos.

In the defulat demo that is checked in I past this

Code: Select all
void KinematicPlacement (DemoEntityManager* const scene)
{
   // load the skybox
   scene->CreateSkyBox();

   // load the scene from a ngd file format

// scale the static wori for testing a crash reported by Lette23
   NewtonBody* body = CreateLevelMesh (scene, "flatPlane.ngd", 1);
   NewtonBodySetCollisionScale (body, 2.0f, 2.0f, 2.0f);


and I do not see any crash,
can you take the code fragment of your app, and pasted in any of the demos to see if it can be reproduced?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: m_MasterNode Assert

Postby FSA » Fri Aug 29, 2014 3:33 pm

No things getting really weird :oops:
The crash only appears on a specific set of bodies. If I scale other bodies everythnig works fine :shock:
I don't now whats going on there. I'll make an complete build and send it to you. Maybe you'll find something. This is really crazy...
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: m_MasterNode Assert

Postby AntonSynytsia » Fri Aug 29, 2014 9:30 pm

Can you tell what kind of bodies? Compound? Convexhull? I can test it on my wrapper.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: m_MasterNode Assert

Postby Julio Jerez » Sat Aug 30, 2014 2:09 am

Ok I see what happened,
when the world is created you are calling function
Code: Select all
void dgWorld::BodyDisableSimulation(dgBody* const body)
{
   if (body->m_masterNode) {
      m_broadPhase->Remove(body);
      dgBodyMasterList::RemoveBody(body);
      m_disableBodies.Insert(0, body);
   }
}


then when some editor function is going to be executed you enable the simulation again.
I think some operation on bodies are not allowed when then simulation is disabled, but I agree it should not crash, I fix now sync again.
BTW cool editor.

does the editor crashes on exit? I get a bad crash on exit I do not know if it is because of Newton, I do not see it on the stack trace, please sync, try and let me know.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: m_MasterNode Assert

Postby FSA » Sat Aug 30, 2014 6:57 am

It worked! No problems any more! Tank you.
Ah okay I didn't know that some functions aren't allowed on disabled bodies.
Yes your versions crashes on exit becaus of heap corruption. As I said I programmed a quick an dirty scene. Normally we have an handler for this sort of crash on exit. It is related to wxWidgets.
This editor will be used for the game which is in development, and it's using newton :D
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: m_MasterNode Assert

Postby manny » Tue Sep 09, 2014 5:10 pm

locking topic!
http://www.instaLOD.io - InstaLOD - State of the art 3D optimization
manny
Site Admin
Site Admin
 
Posts: 131
Joined: Tue Feb 11, 2014 6:49 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron