[vtkusers] VTK and Cocoa on Mac OS X

Albion Baucom baucom at biology.ucsc.edu
Sun Jul 11 15:54:06 EDT 2004


I have a VTK view that instantiates and draws objects just fine if I add
it as a custom view in the Interface Builder.

My application launches, I use the menu option "New" and it opens a window
with a scene that works great. This is all working via the NIB file.

When I try to just include the header of that custom view (a subclass of
vtkCocoaGLView) to a document based application object that subclasses
NSDocument, my program segfaults (signal 10 (SIGBUS), BAD_EXC_ACCESS)

I don't even have try to call anything in the class. Just adding the
header file makes it fault.

This is a mixed Objective-C/C++ project on 10.3 using Xcode.

If I run the application in the debugger the fault occurs at the following
call

vtkInstantiatorHashTable::Hash(char const*)

which follows

vtkInstantiatorHashTable:Insert(char const*, vtkObject* (*)())

It is the same call that faults every time.

Can anyone shed some light on what is going on here, or point me to an
example of a call to a vtkCocoaGLView subclass from any Objective-C code
(infact, any number of Cocoa and VTK examples would be great)? There is an
example on MacDevCenter, but that example never has the Objective-C code
directly calling the custom view code; it only accesses the view via the
NIB.

I ultimately need to pass a file name to an object that uses data to
instantiate a new view, but including any headers of anything that
includes VTK in my Objective-C causes the fault. There are no warnings
during complilation that indicate this might happen.

Thanks

Albion

Albion E. Baucom
http://rna.ucsc.edu/albion



More information about the vtkusers mailing list