mitsuhiko's picture

Context Shutdown on OS X Fails

Project:The Open Toolkit library
Category:bug report

When an OpenTK OpenGL application shuts down on OS X the user will see the following output in the console:

Sun Jan 30 15:39:09 nausicaa.local mono[61330] : kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 231040
Sun Jan 30 15:39:09 nausicaa.local mono[61330] : kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Sun Jan 30 15:39:09 nausicaa.local mono[61330] : kCGErrorIllegalArgument: CGSRemoveSurface: Invalid window 0x38680

It does not happen on every application though, so I am unsure how to fix that.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture


I have seen this before but I no longer have access to Mac OS X so I cannot debug this on my own.

Try compiling a debug version of OpenTK.sln and running your application with that. If possible, use SVN trunk to check, since it contains a few Mac-related fixes.

The debug version adds logs diagnostic messages to System.Diagnostics.Debug. You can redirect those messages to the console with:

// Add to the top of your Main function.
TextWriterTraceListener console_writer = new 

(You will probably have to compile your application in debug mode for this to work.)

Please post these messages here, they might provide a clue.

Edit: what do the applications that suffer from this have in common? (For instance, do they use textures or vertex buffers, when the rest do not?)