Revision: 19702
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19702
Author:   campbellbarton
Date:     2009-04-13 06:54:12 +0200 (Mon, 13 Apr 2009)

Log Message:
-----------
Bullet integration uninitialised values.

Erwin, r16812 "Add Fh/Rot Fh to Bullet" - added this function
  ClosestRayResultCallbackNotMe(rayFromWorld,rayToWorld,body,parentBody)
  
  ...but parentBody was being ignored and the m_parent value wasn't being 
initialized.


Run memset() on CcdConstructionInfo which had some unset members for 
CreateSphereController() and CreateConeController().

Modified Paths:
--------------
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

Modified: 
trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp    
2009-04-13 03:43:16 UTC (rev 19701)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp    
2009-04-13 04:54:12 UTC (rev 19702)
@@ -660,9 +660,10 @@
 public:
        ClosestRayResultCallbackNotMe(const btVector3& rayFromWorld,const 
btVector3& rayToWorld,btCollisionObject* owner,btCollisionObject* parent)
                
:btCollisionWorld::ClosestRayResultCallback(rayFromWorld,rayToWorld),
-               m_owner(owner)
+               m_owner(owner),
+               m_parent(parent)
        {
-
+               
        }
 
        virtual bool needsCollision(btBroadphaseProxy* proxy0) const
@@ -710,7 +711,7 @@
                        //btVector3     rayToWorld = rayFromWorld + 
body->getCenterOfMassTransform().getBasis() * rayDirLocal;
                        //ray always points down the z axis in world space...
                        btVector3       rayToWorld = rayFromWorld + rayDirLocal;
-
+                       
                        ClosestRayResultCallbackNotMe   
resultCallback(rayFromWorld,rayToWorld,body,parentBody);
 
                        
m_dynamicsWorld->rayTest(rayFromWorld,rayToWorld,resultCallback);
@@ -1558,8 +1559,8 @@
 {
        
        CcdConstructionInfo     cinfo;
-       // memory leak! The shape is not deleted by Bullet and we cannot add it 
to the KX_Scene.m_shapes list
-       cinfo.m_collisionShape = new btSphereShape(radius);
+       memset(&cinfo, 0, sizeof(cinfo)); /* avoid uninitialized values */
+       cinfo.m_collisionShape = new btSphereShape(radius); // memory leak! The 
shape is not deleted by Bullet and we cannot add it to the KX_Scene.m_shapes 
list
        cinfo.m_MotionState = 0;
        cinfo.m_physicsEnv = this;
        // declare this object as Dyamic rather then static!!
@@ -2018,7 +2019,7 @@
 PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float 
coneradius,float coneheight)
 {
        CcdConstructionInfo     cinfo;
-
+       memset(&cinfo, 0, sizeof(cinfo)); /* avoid uninitialized values */
        // we don't need a CcdShapeConstructionInfo for this shape:
        // it is simple enough for the standard copy constructor (see 
CcdPhysicsController::GetReplica)
        cinfo.m_collisionShape = new btConeShape(coneradius,coneheight);


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to