kvark's picture

GameWindow fails to delete device context

Project:The Open Toolkit library
Category:bug report
Assigned:the Fiddler

Creating a GL 3.0 forward-compatible context GameWindow.
After window closing the log reports a warning:

[Warning] Failed to release device context -1442770760. Windows error: 1412.

Full application log1.92 KB


Comment viewing options

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



Judging from the log, this is relatively harmless: a DC reference remains live after the window it refers to is disposed. The error should be easy to fix once I manage to reproduce it.

kvark's picture


This may help you to reproduce it:
WinXP SP3, .NET 3.5
Catalyst 9.5 on Radeon HD 2400
GL 3.0 fw-compat context

the Fiddler's picture


Title:GameWindow fails to delete GL context» GameWindow fails to delete device context
Assigned to:Anonymous» the Fiddler
kvark's picture


Just checkout'ed the source from SVN and built. The warning message changed:

[Warning] INativeWindow leaked (OpenTK.Platform.Windows.WinGLNative). Did you forget to call INativeWindow.Dispose()?
[Warning] OpenGL context 196608 leaked. Did you forget to call IGraphicsContext.Dispose()?

the Fiddler's picture


Status:open» closed

I can reproduce this on 0.9.8-1, but not 0.9.9-0 - seems it is already fixed there. :)

the Fiddler's picture


Status:closed» open

Sorry, I posted while you where typing. Did you checkout trunk or branches/0.9.8?

kvark's picture


I'm glad you are able to reproduce it.

the Fiddler's picture


Just to make sure, are you calling Dispose() on the GameWindow?

Ideally you'd use the disposable pattern, which calls dispose for you:

using (GameWindow game = new GameWindow())
kvark's picture


Status:open» closed

No, I'm not:)

At the time I started using GameWindow, I didn't know what is 'using' for...
It's a pity the one has to use Dispose/using in order to keep things in proper order for the destruction.

Thank's, Fiddler

the Fiddler's picture


No problem :)

Classes that hold unmanaged resources tend to implement IDisposable, because they don't play well with the GC. The .Net runtime trades convenience (deterministic finalization) for performance and the only way to get this back is to use a hack like IDisposable.