diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/intern/bpy_app_handlers.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 34ffef03e66..319ca7baea1 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -266,13 +266,18 @@ void BPY_app_handlers_reset(const short do_all) PyObject *ls = py_cb_array[pos]; Py_ssize_t i; - PyObject *item; - PyObject **dict_ptr; - for (i = PyList_GET_SIZE(ls) - 1; i >= 0; i--) { + PyObject *item = PyList_GET_ITEM(ls, i); + + if (PyMethod_Check(item)) { + PyObject *item_test = PyMethod_GET_FUNCTION(item); + if (item_test) { + item = item_test; + } + } - if (PyFunction_Check((item = PyList_GET_ITEM(ls, i))) && - (dict_ptr = _PyObject_GetDictPtr(item)) && (*dict_ptr) && + PyObject **dict_ptr; + if (PyFunction_Check(item) && (dict_ptr = _PyObject_GetDictPtr(item)) && (*dict_ptr) && (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL)) { /* keep */ } |