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:
parent
39a526a963
commit
3e490c0203
@ -100,7 +100,18 @@ int setup_armature_weakrefs()
|
||||
|
||||
main_module = PyImport_AddModule( "__main__");
|
||||
if(main_module){
|
||||
PyObject *weakreflink;
|
||||
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,
|
||||
list_name,
|
||||
PyList_New(0)) == -1){
|
||||
|
Loading…
Reference in New Issue
Block a user