0

I'm trying to programmatically create a window with my own custom OpenGL NSView as it's view, but I'm having a problem with ARC destroying my view. This is the code I'm using now:

[_window setContentView:[[MyOpenGLView alloc] init]];

MyOpenGLView is just an NSView where I handle all my OpenGL calls. I set up OpenGL in my initWithFrame:(NSRect) and then return myself. I can step through that code and it works correctly. The problem is that as soon as the setContentView gets called, my newly allocated MyOpenGLView gets autoreleased. Is there a way to make the window retain the view?

Kyle
  • 1,111
  • 1
  • 12
  • 27

1 Answers1

0

The problem had nothing to do with my view, but with my CVDisplayLinkOutputCallback not having an @autoreleasepool block set up. This question gives the right way to set up a CVDisplayLink callback.

Community
  • 1
  • 1
Kyle
  • 1,111
  • 1
  • 12
  • 27