[Bf-python] Python bug with user counts

Ken Hughes khughes at pacific.edu
Sun Jan 21 20:24:53 CET 2007


I think this might be a show-stopper bug, but before trying to fix 
thought I should discuss here:

I chased a segfault/memcorruption problem for about three hours this 
morning before finding the cause.  The problem is with Python objects 
being users of Blender data (i.e., id.us).  To make a long story short, 
when an exception happens Object_dealloc() isn't called, so any BPy 
Objects existing at that point leave the real Blender objects with an 
incorrect number of users.  After reloading the .blend file and running 
the script again (or a few times, it varies) would cause a crash.

I verified this also happens with 2.42a.

The simplest solution is to get rid of the id.us manipulation.  But how 
many script rely on this now?
The next solution would be to correctly deallocate objects when an 
exception is thrown.  But I don't know how to do that or if it's 
possible.  If we go that route, does anyone know how to do it?

Ken




More information about the Bf-python mailing list