[vtkusers] vtkCocoaRenderWindowInteractor - memory violation when dealloc

David Gobbi david.gobbi at gmail.com
Thu Jan 30 12:21:59 EST 2014


Hi Aaron,

In the code sample that you sent a few emails ago, it looked like you
were passing the window Id to SetWindowId() and passing the NSView id
to SetDisplayId().  I'm pretty sure that is incorrect.  The
documentation for vtkCocoaGLWindow says the following:

SetWindowId(void *):
  Sets the NSView* associated with this vtkRenderWindow.
  This class' default behaviour, that is, if you never call this
  SetWindowId()/SetRootWindow() is to create an NSWindow
  and a vtkCocoaGLView (NSView subclass) which are used
  together to draw all vtk stuff into. If you already have an
  NSWindow and NSView and you want this class to use them
  you must call both SetRootWindow() and SetWindowId(),
  respectively, early on (before WindowInitialize() is executed).
  In the case of Java, you should call only SetWindowId().

When I use vtkCocoaGLWindow, I only use SetWindowId(), and I pass it
a pointer to an NSView (never a pointer to an NSWindow).  I don't have to do
anything special to get a clean destruction.  But I'm using Cocoa via Qt, so
YMMV.

 David


More information about the vtkusers mailing list