Added a second terminating 0 to attribute list, trying to work around issue [#1352]: "Occasional AccessViolationExceptions when creating the GLControl".

This commit is contained in:
the_fiddler 2009-11-08 22:42:20 +00:00
parent f03a6ddc76
commit a0e95055e3
2 changed files with 11 additions and 0 deletions

View file

@ -102,6 +102,11 @@ namespace OpenTK.Platform.Windows
#warning "This is not entirely correct: Embedded is not a valid flag! We need to add a GetARBContextFlags(GraphicsContextFlags) method." #warning "This is not entirely correct: Embedded is not a valid flag! We need to add a GetARBContextFlags(GraphicsContextFlags) method."
attributes.Add((int)flags); attributes.Add((int)flags);
} }
// According to the docs, " <attribList> specifies a list of attributes for the context.
// The list consists of a sequence of <name,value> pairs terminated by the
// value 0. [...]"
// Is this a single 0, or a <0, 0> pair? (Defensive coding: add two zeroes just in case).
attributes.Add(0);
attributes.Add(0); attributes.Add(0);
Handle = new ContextHandle( Handle = new ContextHandle(

View file

@ -110,9 +110,15 @@ namespace OpenTK.Platform.X11
attributes.Add(minor); attributes.Add(minor);
if (flags != 0) if (flags != 0)
{ {
#warning "This is not entirely correct: Embedded is not a valid flag! We need to add a GetARBContextFlags(GraphicsContextFlags) method."
attributes.Add((int)ArbCreateContext.Flags); attributes.Add((int)ArbCreateContext.Flags);
attributes.Add((int)flags); attributes.Add((int)flags);
} }
// According to the docs, " <attribList> specifies a list of attributes for the context.
// The list consists of a sequence of <name,value> pairs terminated by the
// value 0. [...]"
// Is this a single 0, or a <0, 0> pair? (Defensive coding: add two zeroes just in case).
attributes.Add(0);
attributes.Add(0); attributes.Add(0);
Handle = new ContextHandle(Glx.Arb.CreateContextAttribs(Display, *fbconfigs, Handle = new ContextHandle(Glx.Arb.CreateContextAttribs(Display, *fbconfigs,