Fix a Python memory leak with the armature weakref code. setup_armature_weakrefs() wasnt't deallocating the old list, instead just adding a new one to the dictionary.
This commit is contained in:
@@ -100,7 +100,18 @@ int setup_armature_weakrefs()
|
|||||||
|
|
||||||
main_module = PyImport_AddModule( "__main__");
|
main_module = PyImport_AddModule( "__main__");
|
||||||
if(main_module){
|
if(main_module){
|
||||||
|
PyObject *weakreflink;
|
||||||
maindict= PyModule_GetDict(main_module);
|
maindict= PyModule_GetDict(main_module);
|
||||||
|
|
||||||
|
/* check if there is already a dict entry for the armature weakrefs,
|
||||||
|
* and delete if so before making another one */
|
||||||
|
|
||||||
|
weakreflink= PyDict_GetItemString(maindict,list_name);
|
||||||
|
if( weakreflink != NULL ) {
|
||||||
|
PyDict_DelItemString(maindict,list_name);
|
||||||
|
Py_XDECREF( weakreflink );
|
||||||
|
}
|
||||||
|
|
||||||
if (PyDict_SetItemString(maindict,
|
if (PyDict_SetItemString(maindict,
|
||||||
list_name,
|
list_name,
|
||||||
PyList_New(0)) == -1){
|
PyList_New(0)) == -1){
|
||||||
|
|||||||
Reference in New Issue
Block a user