diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-26 02:35:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-26 02:35:58 +0300 |
commit | a306759b7af05914a46eb9fec2dd3cc50aa6f20f (patch) | |
tree | 5f4da8c1f08c71e7591709eb20af09c7574d17d6 /source/gameengine/Ketsji/KX_Scene.cpp | |
parent | aa5227664ab419d5446466fe0b3a368b05281fbe (diff) |
small change to BGE callbacks, only allocate empty args once in the callback loop.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 2aff57961d8..b45fecb0f98 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -412,6 +412,7 @@ void KX_Scene::RunDrawingCallbacks(PyObject* cb_list) if (cb_list && (len=PyList_GET_SIZE(cb_list))) { + PyObject* args= PyTuple_New(0); // save python creating each call PyObject* func; PyObject* ret; @@ -419,7 +420,7 @@ void KX_Scene::RunDrawingCallbacks(PyObject* cb_list) for (int pos=0; pos < len; pos++) { func= PyList_GET_ITEM(cb_list, pos); - ret= PyObject_CallObject(func, NULL); + ret= PyObject_Call(func, args, NULL); if (ret==NULL) { PyErr_Print(); PyErr_Clear(); @@ -428,6 +429,8 @@ void KX_Scene::RunDrawingCallbacks(PyObject* cb_list) Py_DECREF(ret); } } + + Py_DECREF(args); } } |