diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-11-06 16:44:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-11-06 16:44:26 +0300 |
commit | 6142ae3785dc62ccb187a345e02981494e7085bf (patch) | |
tree | b5fd765da833d66f9bdd26067e1fc1b85d311bc4 /source/blender/python/BPY_interface.c | |
parent | 9cd76a66096491e8994090e1992bb54d19c61950 (diff) |
==Python API==
Bugfix, Space Handlers could crash blender when used with armatures.
also fixed some possible bugs in other areas.
Diffstat (limited to 'source/blender/python/BPY_interface.c')
-rw-r--r-- | source/blender/python/BPY_interface.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 238c05d54a4..9c8203cf3fd 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -1938,6 +1938,7 @@ void BPY_do_pyscript( ID * id, short event ) scriptlink = ID_getScriptlink( id ); if( scriptlink && scriptlink->totscript ) { + PyObject *value; PyObject *dict; PyObject *ret; int index, during_slink = during_scriptlink( ); @@ -1947,7 +1948,13 @@ void BPY_do_pyscript( ID * id, short event ) return; if( !setup_armature_weakrefs()){ - printf("Oops - weakref dict\n"); + printf("Oops - weakref dict, this is a bug\n"); + return; + } + + value = GetPyObjectFromID( id ); + if( !value){ + printf("Oops - could not get a valid python object for Blender.link, this is a bug\n"); return; } @@ -1959,8 +1966,8 @@ void BPY_do_pyscript( ID * id, short event ) /* set globals in Blender module to identify scriptlink */ EXPP_dict_set_item_str( g_blenderdict, "bylink", EXPP_incr_ret_True() ); - EXPP_dict_set_item_str( g_blenderdict, "link", - GetPyObjectFromID( id ) ); + + EXPP_dict_set_item_str( g_blenderdict, "link", value ); EXPP_dict_set_item_str( g_blenderdict, "event", PyString_FromString( event_to_name ( event ) ) ); @@ -2178,6 +2185,11 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event, disable_where_scriptlink( (short)during_slink ); } + if( !setup_armature_weakrefs()){ + printf("Oops - weakref dict, this is a bug\n"); + return 0; + } + /* set globals in Blender module to identify space handler scriptlink */ EXPP_dict_set_item_str(g_blenderdict, "bylink", EXPP_incr_ret_True()); /* unlike normal scriptlinks, here Blender.link is int (space event type) */ |