[Bf-python] Crashing Blender with incomplete objects

Willian Padovani Germano wgermano at ig.com.br
Fri Oct 3 04:31:40 CEST 2003


Hi,

From: "Michel Selten" <michel.s at home.nl>
(...)
> Due to a bug report that I investigated, I came up with another crash
> causing script in Blender. This one is pretty serious I think. It can
> affect a couple of modules.
(...)
> This problem is related, I think, to the Object.link() messages we had
> on the list a couple of weeks ago.

Mmm ... yes, from what I remember, Object.New() created default object data
for each object and I changed that so that we wouldn't create things that
would be left unused (no garbage collecting in Blender).

Joseph's investigation confirms that the problem is NULL object->data.  So
the "fix" is causing more trouble than it should.

> One solution I can come up with is to implement a function in each
> module that checks if the object passed to it, is a 'clean' object. With
> a clean object, I mean that no data is missing.

This would force an order: first link obdata to ob, then ob to scene, which
can break existing scripts.  We could track and give an error if things
weren't "clean" only in the end of the script execution, but this would be
cumbersome.

I don't like (and we sure need to talk to Ton first, since Blender itself
doesn't do this) the idea of creating obdata just to delete it a while
later.  This can also force us to check against NULL in most if not all
methods, argh (look Text.c).

What about this? -> in scene.link(ob), if ob->data is NULL, we create the
data right there.  This should fix crashes and only create extra obdata
(that in some cases will be unlinked) for scripts that didn't behave nicely.
So we fix the crash and reduce potential misuse.   In the docs we recommend
that users link to obdata before linking to scenes.

Well, I'll try this.  Next week we put all the fixes and test object / nmesh
creation and linking throughly.  Let's see if we get some test scripts done
this time, they are necessary to have.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list