Commit: 9bd2a7c0a8fff43d9193184ca6920b4aaed5f6c1 Author: Jorge Bernal Date: Wed Feb 18 19:52:54 2015 +0100 Branches: master https://developer.blender.org/rB9bd2a7c0a8fff43d9193184ca6920b4aaed5f6c1
BGE: Fix T41570: Blender crash when physics createConstraint Move physicsid type to unsigned long long to avoid crashes on Windows 8.1 64bits. Other systems also modified to put them inline with this solution. Reviewers: dfelinto, brita_, moguri, juicyfruit, campbellbarton Reviewed By: juicyfruit, campbellbarton Subscribers: juicyfruit Differential Revision: https://developer.blender.org/D1122 =================================================================== M source/gameengine/Ketsji/KX_GameObject.cpp M source/gameengine/Ketsji/KX_PyConstraintBinding.cpp =================================================================== diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 6d4b556..8d22c91 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -36,14 +36,6 @@ # pragma warning( disable:4786 ) #endif -#if defined(_WIN64) && !defined(FREE_WINDOWS64) -typedef unsigned __int64 uint_ptr; -#elif defined(FREE_WINDOWS64) -typedef unsigned long long uint_ptr; -#else -typedef unsigned long uint_ptr; -#endif - #include "RAS_IPolygonMaterial.h" #include "KX_BlenderMaterial.h" #include "KX_GameObject.h" @@ -3294,12 +3286,12 @@ PyObject *KX_GameObject::PyGetAxisVect(PyObject *value) PyObject *KX_GameObject::PyGetPhysicsId() { PHY_IPhysicsController* ctrl = GetPhysicsController(); - uint_ptr physid=0; + unsigned long long physid = 0; if (ctrl) { - physid= (uint_ptr)ctrl; + physid = (unsigned long long)ctrl; } - return PyLong_FromLong((long)physid); + return PyLong_FromUnsignedLongLong(physid); } PyObject *KX_GameObject::PyGetPropertyNames() diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index 1b69eab..51ae5ca 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -495,11 +495,7 @@ static PyObject *gPyCreateConstraint(PyObject *self, PyObject *kwds) { /* FIXME - physicsid is a long being cast to a pointer, should at least use PyCapsule */ -#if defined(_WIN64) - __int64 physicsid=0,physicsid2 = 0; -#else - long physicsid=0,physicsid2 = 0; -#endif + unsigned long long physicsid = 0, physicsid2 = 0; int constrainttype=0, extrainfo=0; int len = PyTuple_Size(args); int success = 1; @@ -508,51 +504,28 @@ static PyObject *gPyCreateConstraint(PyObject *self, float pivotX=1,pivotY=1,pivotZ=1,axisX=0,axisY=0,axisZ=1; if (len == 3) { -#if defined(_WIN64) - success = PyArg_ParseTuple(args,"LLi",&physicsid,&physicsid2,&constrainttype); -#else - success = PyArg_ParseTuple(args,"lli",&physicsid,&physicsid2,&constrainttype); -#endif + success = PyArg_ParseTuple(args, "KKi", &physicsid, &physicsid2, &constrainttype); } else if (len == 6) { -#if defined(_WIN64) - success = PyArg_ParseTuple(args,"LLifff",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ); -#else - success = PyArg_ParseTuple(args,"llifff",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ); -#endif + success = PyArg_ParseTuple(args, "KKifff", &physicsid, &physicsid2, &constrainttype, + &pivotX, &pivotY, &pivotZ); } else if (len == 9) { -#if defined(_WIN64) - success = PyArg_ParseTuple(args,"LLiffffff",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ); -#else - success = PyArg_ParseTuple(args,"lliffffff",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ); -#endif + success = PyArg_ParseTuple(args, "KKiffffff", &physicsid, &physicsid2, &constrainttype, + &pivotX, &pivotY, &pivotZ, &axisX, &axisY, &axisZ); } else if (len == 10) { -#if defined(_WIN64) - success = PyArg_ParseTuple(args,"LLiffffffi",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag); -#else - success = PyArg_ParseTuple(args,"lliffffffi",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag); -#endif + success = PyArg_ParseTuple(args, "KKiffffffi", &physicsid, &physicsid2, &constrainttype, + &pivotX, &pivotY, &pivotZ, &axisX, &axisY, &axisZ, &flag); } /* XXX extrainfo seems to be nothing implemented. right now it works as a pivot with [X,0,0] */ else if (len == 4) { -#if defined(_WIN64) - success = PyArg_ParseTuple(args,"LLii",&physicsid,&physicsid2,&constrainttype,&extrainfo); -#else - success = PyArg_ParseTuple(args,"llii",&physicsid,&physicsid2,&constrainttype,&extrainfo); -#endif + success = PyArg_ParseTuple(args,"KKii", &physicsid, &physicsid2, &constrainttype, &extrainfo); pivotX=extrainfo; } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs