Bug fix for:

[ #5000 ] Changin EditMode in Script wrecks memory

Armatures create weakreferences in __main__.__dict__.  When Window.Editmode is called, the weaklist it iterated over and armatures are updated.
This commit is contained in:
2007-01-25 15:19:28 +00:00
parent 8c2af0a5d0
commit ea8189389c
4 changed files with 58 additions and 5 deletions

View File

@@ -478,6 +478,7 @@ void BPY_Err_Handle( char *script_name )
*****************************************************************************/
int BPY_txt_do_python_Text( struct Text *text )
{
PyObject *maindict = NULL;
PyObject *py_dict, *py_result;
BPy_constant *info;
char textname[24];
@@ -524,6 +525,12 @@ int BPY_txt_do_python_Text( struct Text *text )
py_dict = CreateGlobalDictionary( );
//setup a weakref dictionary on __main__
maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
if (PyDict_SetItemString(maindict, "armatures", PyList_New(0)) == -1){
return 0;
}
script->py_globaldict = py_dict;
info = ( BPy_constant * ) PyConstant_New( );