From 682e5608e7e8f2e3eddf4be14ce296c0ea84eb42 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 4 May 2009 07:40:30 +0000 Subject: [PATCH] Memory leak --- panda/src/ode/odeBody.I | 1 + panda/src/ode/odeBody.cxx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/panda/src/ode/odeBody.I b/panda/src/ode/odeBody.I index 86896d4f2d..24b13e6e8e 100755 --- a/panda/src/ode/odeBody.I +++ b/panda/src/ode/odeBody.I @@ -98,6 +98,7 @@ set_data(void *data) { #ifdef HAVE_PYTHON INLINE void OdeBody:: set_data(PyObject *data) { + Py_XDECREF((PyObject*) dBodyGetData(_id)); Py_XINCREF(data); dBodySetData(_id, data); } diff --git a/panda/src/ode/odeBody.cxx b/panda/src/ode/odeBody.cxx index 19d0e6f651..27a4d74c8e 100755 --- a/panda/src/ode/odeBody.cxx +++ b/panda/src/ode/odeBody.cxx @@ -34,6 +34,9 @@ OdeBody:: void OdeBody:: destroy() { +#ifdef HAVE_PYTHON + Py_XDECREF((PyObject*) dBodyGetData(_id)); +#endif nassertv(_id); dBodyDestroy(_id); }