• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: VTK and Cocoa on Mac OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VTK and Cocoa on Mac OS X


  • Subject: Re: VTK and Cocoa on Mac OS X
  • From: Drew McCormack <email@hidden>
  • Date: Mon, 12 Jul 2004 08:03:21 +0200

On Jul 11, 2004, at 9:57 PM, Albion Baucom wrote:

(I sent this to the VTK-Users forum, but thought I would try here too
incase someone else was using VTK and Cocoa. VTK is the Visualization
Toolkit, www.vtk.org).

So ...

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

Hi Albion,
Here are some things I would check:

- Make sure you are not autoreleasing your view in some way. That could cause a seg fault
- The other difference which can arise when you programmatically instantiate, as opposed to via a NIB, is the constructor that is called. If you use a custom view in the nib, I believe initWithFrame: is called. If you use an NSOpenGLView in the NIB, I think the constructor is different again. When you do it programmatically, it is up to you. Which constructor do you call?
- If you are using NSDocument, are you remembering to create the view in your archiving method?
- If all else fails, just run the debugger, and use the traceback panel to find where in your code the problem arises from. This is probably the first thing you should do. Maybe that will tell you more about where the problem lies.

Drew
---------------------------------------------------------
Drew McCormack

www.maniacalextent.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >VTK and Cocoa on Mac OS X (From: Albion Baucom <email@hidden>)

  • Prev by Date: Re: What's better a separate run loop or separate thread?
  • Next by Date: Re: VTK and Cocoa on Mac OS X
  • Previous by thread: VTK and Cocoa on Mac OS X
  • Next by thread: Re: VTK and Cocoa on Mac OS X
  • Index(es):
    • Date
    • Thread