[Bf-python] Memory bug in Bpy api

Bobby Parker sh0rtwave at gmail.com
Tue Jan 17 22:54:17 CET 2006


Hi,
I'm developing a script using the Python API, and I think I've found a nice
memory bug.

To best illuminate the error, I've provided a working copy of my script at:
http://www.stormwind-studios.com/Misc/ShaderEditorGUI.zip

Download this, create a subdirectory of bpymodules named "btor", and unzip
into that dir.

CgKit2(http://cgkit.sourceforge.net) and a renderman renderer (
http://www.aqsis.com, http://pixie.sourceforge.net ) are required.

Load the BtoR.py script in the btor package directory into the blender text
editor and hit alt+p

In the "Shader Path" enter a path (or browse) to a directory containing
renderman shader source files (*.sl). (for instance, on Debian, using Aqsis,
the shaders are at /usr/share/Aqsis/shaders/)

This should iterate the shaders on that path, and sort them into types.

The behaviour I've noticed is that on most first-time loads, the script
works fine. When selected different shaders and scrolling up and down (with
the mousewheel) shaders with large #'s of parameters will cause a crash.

If the script doesn't crash the first time around, it almost always crashes
on the second invocation of the script (alt+p after escaping out).

antont in #blendercoders was kind enough to test it in a debug build of
Blender, and recieved the following results:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1226287392 (LWP 27752)]
0xb7eac05e in PyObject_GC_UnTrack () from /usr/lib/libpython2.4.so.1.0
(gdb) bt

#0  0xb7eac05e in PyObject_GC_UnTrack () from /usr/lib/libpython2.4.so.1.0
#1  0xb7e538fa in PyTuple_Pack () from /usr/lib/libpython2.4.so.1.0
#2  0xb7e80dfa in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0

#3  0xb7e31f19 in PyFunction_SetClosure () from /usr/lib/libpython2.4.so.1.0
#4  0xb7e4192d in PyDict_New () from /usr/lib/libpython2.4.so.1.0
#5  0xb7e41bf5 in PyDict_SetItem () from /usr/lib/libpython2.4.so.1.0

#6  0xb7e7fa36 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#7  0xb7e80a2d in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#8  0xb7e80b76 in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0

#9  0xb7e99525 in PyImport_ExecCodeModuleEx ()
   from /usr/lib/libpython2.4.so.1.0
#10 0xb7e998e9 in PyImport_ExecCodeModule () from /usr/lib/libpython2.4.so.1.0
#11 0xb7e9b91e in PyImport_ReloadModule () from /usr/lib/libpython2.4.so.1.0

#12 0x086041cc in blender_reload ()
#13 0xb7e44923 in PyCFunction_Call () from /usr/lib/libpython2.4.so.1.0
#14 0xb7e7ff37 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#15 0xb7e80a2d in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0

#16 0xb7e80b76 in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0
#17 0x08602d22 in RunPython ()
#18 0x08603bb4 in BPY_txt_do_python_Text ()
#19 0x0822aab5 in run_python_script ()
#20 0x0822b132 in winqreadtextspace ()

#21 0x081bd46a in scrarea_do_winhandle ()



Hope this helps! It's driving me UP THE WALL!

ShortWave in #blendercoders, #blender, #aqsis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20060117/4e622221/attachment.html>


More information about the Bf-python mailing list