
Unhandled exception in GlControl possible bug in rev 2207
Posted Thursday, 3 September, 2009 - 10:22 by iliak| Project: | The Open Toolkit library |
| Version: | 0.9.9-2b |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
In GLControl.cs line 209 :
/// <summary> /// Makes the underlying this GLControl current in the calling thread. /// All OpenGL commands issued are hereafter interpreted by this GLControl. /// </summary> public void MakeCurrent() { Context.MakeCurrent(Implementation.WindowInfo); }
No check is done if Context is null. Would be a good idea to handle the case where Context is invalid


Comments
#1
Public methods in GLControl fail to validate internal state. This should be fixed.
The question is whether we should throw an exception or (re-)initialize the GLControl silently. Windows.Forms tend to do the latter, for example when you try to access the Handle of an uninitialized Control.
Any ideas?
#2
(Forgot to change the status)
#3
I would to something like this :
#4
I have committed a fix to rev. 2209 that checks whether the GLControl has been disposed (ObjectDisposedException) and tries to create/recreate the control if it doesn't have a handle/context respectively.
Can you please test that this hasn't introduced any bad side-effects on Windows? (Try running the various GLControl samples in Examples.exe -> OpenTK).
The documentation should also be updated to reflect the new behavior, will do that once you confirm that this hasn't introduced any regressions.
#5
Looks fine...
#6
Thanks, marking as fixed.
#7
Closing issues fixed in 0.9.9-2.