[vtk-developers] VTK Python crash with DeleteEvent

Prabhu Ramachandran prabhu at aero.iitb.ac.in
Thu Apr 10 10:38:05 EDT 2014


Hi everyone,

I just noticed a very serious crash with VTK Python using VTK-6.1.  This 
only happens with the Python wrappers.   It does not not crash with 
VTK-6.0.0.  The code to reproduce this is the following:

# ---------------
import vtk
obj = vtk.vtkObject()
obj.AddObserver('DeleteEvent', lambda o, e:None)
del obj
# -------------

I get the following crash report on OS X.

python(33000) malloc: *** error for object 0x1090113a0: pointer being 
freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff86fc9d46 __kill + 10
1   libsystem_c.dylib             	0x00007fff85674f83 abort + 177
2   libsystem_c.dylib             	0x00007fff85648989 free + 392
3   libvtkWrappingPython27Core-6.1.1.dylib	0x00000001004c461f 
std::_Rb_tree<vtkObjectBase*, std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue>, 
std::_Select1st<std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue> >, std::less<vtkObjectBase*>, 
std::allocator<std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue> > 
 >::_M_erase(std::_Rb_tree_node<std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue> >*) + 101
4   libvtkWrappingPython27Core-6.1.1.dylib	0x00000001004c466f 
std::_Rb_tree<vtkObjectBase*, std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue>, 
std::_Select1st<std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue> >, std::less<vtkObjectBase*>, 
std::allocator<std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue> > 
 >::erase(std::_Rb_tree_iterator<std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue> >, 
std::_Rb_tree_iterator<std::pair<vtkObjectBase* const, 
vtkPythonReferenceCountedValue> >) + 51
5   libvtkWrappingPython27Core-6.1.1.dylib	0x00000001004c3146 
vtkPythonUtil::RemoveObjectFromMap(_object*) + 308
6   libvtkWrappingPython27Core-6.1.1.dylib	0x00000001004c7e93 
PyVTKObject_Delete(_object*) + 35
[...]

I haven't yet debugged this but it seems like the last commit to 
vtkPythonUtil.cxx is the culprit:

http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=269cbea1dd8d19c8b5cfb76b341f8bc538f7035a


Thanks.

cheers,
Prabhu


More information about the vtk-developers mailing list