0

I have a crash in my AudioUnit plug-in (running under Logic 9 and Logic X - Mac OS X 10.8.4. Does not reproduce in AU Lab)

My AudioUnit plug-ins performs the draw in a separate thread. When a Plug-in GUI is closed the AU plug-in receives a call to: NSView removeFromSuperviewWithoutNeedingDisplay Problem is, that starting OS X 10.8.4, at the time the AU is called with this function, my separate thread that performs the draw is still running. However, at this point some things are already destroyed so I receive an openGL error while attempting the draw: Invalid framebuffer operation(1286). This of course leads to graphic corruption in the next plug-in GUI draw, and also to a crash after several GUI open and close attempts.

The questions are: 1. Is there a function that can be implemented that is called before NSView removeFromSuperviewWithoutNeedingDisplay? This way, I can stop the drawing in the separate thread before Logic destroys the view. 2. If there is no way, do you have any other suggestion? Maybe check something in every attempt to draw?

Thanks! C.

Bryan Chen
  • 45,816
  • 18
  • 112
  • 143
Mr C.
  • 1

1 Answers1

0

The removeFromSuperviewWithoutNeedingDisplay method might not be the best point to shut down the subView UI.

There are two options:

  1. Subscribe and react to the plugin host window NSWindowWillClose notification.

  2. React when the NSView method - (void) viewWillMoveToWindow:(NSWindow)w

is called with w==nil (which basically means the view will be removed very soon from the window).

In both cases, it is possible to react immediately before the window is closed or the view hierarchy is changed, and so there is still a "normal" UI environment for the SubView.

Mr C.
  • 1