[Bf-python] Crashing Blender with incomplete objects

models at paposo.com models at paposo.com
Fri Oct 3 01:57:47 CEST 2003


I tried this script and this is what i saw:

This is the call stack before it blows up:

drawcamera(Object * 0x01198a7c) line 643 + 6 bytes
draw_object(Base * 0x0119c09c) line 3627 + 9 bytes
drawview3dspace(ScrArea * 0x0118397c, void * 0x0118379c) line 942 + 9 bytes
scrarea_do_windraw(ScrArea * 0x0118397c) line 108 + 22 bytes
scrarea_dispatch_events(ScrArea * 0x0118397c) line 521 + 12 bytes
screen_dispatch_events() line 857 + 9 bytes
screenmain() line 1071
main(int 1, char * * 0x01170ed0) line 548
mainCRTStartup() line 206 + 25 bytes
KERNEL32! 77e814c7()

So drawview3dspace calls -> draw_object which calls -> drawcamera.
It implodes on line 643 in drawobject.c inside the function drawcamera:

631:  void drawcamera(Object *ob)
632:  {
633:      /* a standing up pyramid with (0,0,0) as top */
634:      Camera *cam;
635:      World *wrld;
636:      float vec[8][4], tmat[4][4], fac, facx, facy, depth;
637:
638:      cam= ob->data;
639:      glDisable(GL_LIGHTING);
640:      glDisable(GL_CULL_FACE)
641:
642:      /* that way it's always visible */
643:      fac= cam->drawsize;                       ---- CRASH

This is probably a bad access because 'cam' doesn't exist. The value of
'cam' is 0x00000000 upon crashing.

So drawview3dspace cycles the G.scene->base and calls draw_object on them.
Draw_object gets base->object->type and calls the appropriate draw
function - in this case it's drawcamera. So the Base is sent to draw_object
and the Object member of Base is sent to drawcamera. This Object member =
NULL that's why there is a crash i think.

Sometime later.......

I tracked down the source of your problems.  When you call
Blender.Object.New() is set the object->data to NULL.  Then you ask the
scene to redraw itself.  It tries for the camera by accessing the
object->data parameter (in drawcamera()) to get the drawsize.  Oops. There
is no drawsize - crash.
So for cameras (at least) if there is a physical object in the 3dview
renderwin.c is assuming that it has a data block to access.






More information about the Bf-python mailing list