[vtk-developers] Bug: Tk + VTK apps crash on exit.

David Gobbi dgobbi at irus.rri.ca
Tue Jan 22 04:11:16 EST 2002

Hi Prabhu,

This might be tough to track down, I didn't see it because I'm still
using python 1.5.2 for the most part.  It seems to have something to
do with the garbage collection in python 2.x, and the fact that I
resurrect python-vtk objects that are passed to VTK-C++, deleted from
python, and then returned from VTK-C++.

There's a simple temporary fix that I can apply.  For the real fix I'll
just have to stop trying to resurrect the python-vtk objects in their
entirety, instead I'll just save their 'dict' which contains all the
information needed to reconstruct them.

Try a checkout and see whether the problem is still there (it will take
me a while to build with a new version of python).

 - David

On Tue, 22 Jan 2002, Prabhu Ramachandran wrote:

> hi,
> I've been running into a strange problem with the Python wrappers.  I
> updated my CVS tree to check out David's subclass stuff and my Tk
> based applications are having trouble with the build.  I did a make
> clean and a new rebuild and still face the following problem.
> Just run vtkTkRenderWidget.py in Wrapping/Python.  Everything runs
> fine but when you exit you get this error.
> $ python vtkTkRenderWidget.py
> Fatal Python error: PyThreadState_Get: no current thread
> Aborted
> $
> While this might not seem a very bad problem it does affect multiple
> windows badly.  For instance if I have two renderwindows open using
> two different Toplevels then if I close one window the whole
> application dies due to the fatal error.  Here is the backtrace on
> gdb.
> >>> execfile('vtkTkRenderWidget.py')
> Fatal Python error: PyThreadState_Get: no current thread
> Program received signal SIGABRT, Aborted.
> [Switching to Thread 1024 (LWP 22238)]
> 0x40336911 in kill () from /lib/libc.so.6
> (gdb) back
> #0  0x40336911 in kill () from /lib/libc.so.6
> #1  0x4002dc0e in pthread_kill () from /lib/libpthread.so.0
> #2  0x4002e0dd in raise () from /lib/libpthread.so.0
> #3  0x40337d71 in abort () from /lib/libc.so.6
> #4  0x0806dde1 in Py_FatalError () at Python/pythonrun.c:1231
> #5  0x0806c270 in PyThreadState_Get () at Python/pystate.c:213
> #6  0x08063b1f in PyErr_Occurred () at Python/errors.c:78
> #7  0x0808e5f2 in lookdict (mp=0x8173e1c, key=0x80dfe94, hash=136886352)
>     at Objects/dictobject.c:249
> #8  0x0808eb4a in PyDict_DelItem (op=0x8173e1c, key=0x80dfe94)
>     at Objects/dictobject.c:548
> #9  0x404fa7c7 in vtkPythonDeleteObjectFromHash (obj=0x8297aa0)
>     at /skratch/prabhu/vtk/cvs/VTK/Common/vtkPythonUtil.cxx:1244
> #10 0x404f90a9 in vtkPythonDeleteCommand::Execute (this=0x82a4368,
>     caller=0x828b850)
>     at /skratch/prabhu/vtk/cvs/VTK/Common/vtkPythonUtil.cxx:364
> #11 0x406e92b5 in vtkSubjectHelper::InvokeEvent (this=0x82c6c60, event=2,
>     callData=0x0, self=0x828b850)
>     at /skratch/prabhu/vtk/cvs/VTK/Common/vtkObject.cxx:421
> #12 0x406e94e2 in vtkObject::InvokeEvent (this=0x828b850, event=2,
>     callData=0x0) at /skratch/prabhu/vtk/cvs/VTK/Common/vtkObject.cxx:495
> #13 0x406e8f89 in vtkObject::UnRegister (this=0x828b850, o=0x0)
>     at /skratch/prabhu/vtk/cvs/VTK/Common/vtkObject.cxx:281
> This is evidently related to the new changes.  Sounds like a key
> error.  I dont really know why exactly the error occurs, I thought it
> might be of some use to David.
> prabhu
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/vtk-developers

More information about the vtk-developers mailing list