Ray cast and joint library.dll crash !

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Ray cast and joint library.dll crash !

Postby Julio Jerez » Sun Aug 15, 2010 8:37 pm

it does teh same thing, whan I type teh password I said this

Nom du fichier : Newton_opengl.rar
Description du fichier : Look at my precedent post for controls
Taille du fichier : 1.66 Mo
Date d'ajout du fichier : 15/08/2010 22:57
Dernier téléchargement : 16/08/2010 02:26
Nombre de téléchargement : 2


and from there it go back to the passworw window again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ray cast and joint library.dll crash !

Postby Stucuk » Mon Aug 16, 2010 2:03 am

You are meant to click the link between the 2 adverts, wait 15 seconds and then click the link that appears there. Main problem with the site is its in French.

Anyway: http://www.stucuk.net/Newton_opengl.rar
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Ray cast and joint library.dll crash !

Postby Julio Jerez » Mon Aug 16, 2010 10:18 am

Ok I have it

what I am suppose to test this, all I see is a complete black screen.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ray cast and joint library.dll crash !

Postby izissise » Mon Aug 16, 2010 10:31 am

I told you just press Space to make some cube
izissise
 
Posts: 23
Joined: Sat Jul 24, 2010 8:20 am

Re: Ray cast and joint library.dll crash !

Postby Julio Jerez » Mon Aug 16, 2010 12:45 pm

Ah ok I will try that.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ray cast and joint library.dll crash !

Postby Julio Jerez » Mon Aug 16, 2010 12:49 pm

I pressed space, and a small code showed up, I can pick it with the mouse cursor and it start to spin.
if I press space some more more cube show up, but it seen to work.

Newton opengl debug.exe and
Newton opengl realease.exe

what is the problem?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ray cast and joint library.dll crash !

Postby izissise » Mon Aug 16, 2010 1:21 pm

Yes but some cube can't be picked and sometime when you release picking the program crash
debug and release version are the same but sometime with the release version only pick able objects move ....
izissise
 
Posts: 23
Joined: Sat Jul 24, 2010 8:20 am

Re: Ray cast and joint library.dll crash !

Postby Julio Jerez » Tue Aug 17, 2010 8:14 am

Ok I played this again and I can not reproduce the error.

But anyway if you are having a crash because a piece of memory allocated in the address space of one DLL in deleted in the address space of a different DLL these are the thing you can do.
-if you are using Netwon.dll you can use the memory allocators to make sure that all allocation are performed in the address apace of your main executable.

You do that like this form the SDk

Code: Select all
// memory allocation for Newton
void* PhysicsAlloc (int sizeInBytes)
{
   g_memory += sizeInBytes;
   return malloc (sizeInBytes);
}

// memory de-allocation for Newton
void PhysicsFree (void *ptr, int sizeInBytes)
{
   g_memory -= sizeInBytes;
   free (ptr);
}

// before you create the first Netwon world
NewtonSetMemorySystem (PhysicsAlloc, PhysicsFree);
// now newton will allocate all memory in the adress space of this application
NetwonCreateworld();


// The Joint Libarry dll doe no have that fintionality, I will added for nes realese, but you can do two thing,
-overload the globa new/operators, and make call and allocation funtion in you main funtion.
-link the joint library as a static dll.


-use and grabage colletion startegy to delete objects, basically you place the in a delete queue, and tnen you delete thso object after the Newton objects update.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ray cast and joint library.dll crash !

Postby izissise » Tue Aug 17, 2010 2:46 pm

Ok, thank you but i thing it when the newton thread calculate the joint as the same time it is destroyed,

But it happen more when simulation is state to space to switch to space simulation press 's'

After a few test it don't happen with earth simulation here the code of space simulation :

Code: Select all
static void ForceAndTorqueCallback_space(const NewtonBody * nBody,float p,int m)
{
    float fMasse;
    float force[3] = {0.0};
    CVector vInertie;
    CVector coor;
    matrice maMatrice;

    NewtonWorld * nWorld = NewtonBodyGetWorld(nBody);


    NewtonBody* tempbody1;

    NewtonBody* tempbody2;

    NewtonBodyGetMassMatrix (nBody, &fMasse, &vInertie.x, &vInertie.y, &vInertie.z);

    NewtonBodyGetMatrix (nBody, &maMatrice.matrice [0][0]);

    coor.x = (maMatrice.matrice [3][0]);
    coor.y = (maMatrice.matrice [3][1]);
    coor.z = (maMatrice.matrice [3][2]);

    tempbody1 = NewtonWorldGetFirstBody (nWorld);
    float tempMasse;
    matrice tempMatrice;
    CVector tempcoor;

    for(int i=0; i < NewtonWorldGetBodyCount(nWorld); i++)
    {
        if((!(tempbody1==nBody))&&(tempbody1!=0))
        {
            if((newton_test_collision(nBody, tempbody1)) == NULL)
            {

                NewtonBodyGetMassMatrix (tempbody1, &tempMasse, &vInertie.x, &vInertie.y, &vInertie.z);

                NewtonBodyGetMatrix (tempbody1, &tempMatrice.matrice [0][0]);

                tempcoor.x = (tempMatrice.matrice [3][0]);
                tempcoor.y = (tempMatrice.matrice [3][1]);
                tempcoor.z = (tempMatrice.matrice [3][2]);




                calcule_gravitation(&fMasse,&tempMasse,&coor,&tempcoor,force);

            }
        }
        if((NewtonWorldGetBodyCount(nWorld)!=1)&&(tempbody1!=0))
        {
            tempbody2 = tempbody1;
            tempbody1 = NewtonWorldGetNextBody (nWorld,tempbody2);
        }
    }

    NewtonBodyAddForce (nBody, force);
}




edit:Stopping thread when joint are destroyed fix the problem !! so thank you for all !!
izissise
 
Posts: 23
Joined: Sat Jul 24, 2010 8:20 am

Re: Ray cast and joint library.dll crash !

Postby Julio Jerez » Tue Aug 17, 2010 3:21 pm

I do not know what the function you posted means, there are no reference to joint in it, or creation or destrution of objects in it.
There are two possibility that a joint can be destroyed.

- if you destroy the joint by calling
delete joint

-the secund is if you destroy a body that have a joint attach to it.
when doing this, newton will delete all joints attached to the body, by calling the joint destructor from newton.
I believe this is what is happing to you, you are probably destroying a body and then destroying the joint.

you just have to be careful than if you destroy the body, you should get rid of your pointer to the joint so that you do no destroy the joint twice.
or you can keep track of the joint and call destroying joint first.

Normally not body have problems with this, Newton is very good a keeping track of objects.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ray cast and joint library.dll crash !

Postby izissise » Tue Aug 17, 2010 3:32 pm

Ok, thank you so it solved but i can't see any solved button .....
izissise
 
Posts: 23
Joined: Sat Jul 24, 2010 8:20 am

Re: Ray cast and joint library.dll crash !

Postby Julio Jerez » Tue Aug 17, 2010 3:35 pm

oh do not worrie about solve bottom in the forum.
what was it?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ray cast and joint library.dll crash !

Postby izissise » Wed Aug 18, 2010 6:22 am

I stop the newton thread when joint are destroyed and it don't happen anymore .....
izissise
 
Posts: 23
Joined: Sat Jul 24, 2010 8:20 am

Previous

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 13 guests