[Bf-python] Python bug with user counts
Campbell Barton
cbarton at metavr.com
Mon Jan 22 00:47:36 CET 2007
I dont think many scripts rely on it so much, but the possibility of a
user removing an Object when the script is accessing it is still there.
This is mainly a problem for scripts that register a draw event,
These scripts should be changed to get the object (active object for
instance) - on demand rather then storing it at launch.
Ken Hughes wrote:
> 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
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-python
mailing list