summaryrefslogtreecommitdiff
path: root/glx/glxext.c
diff options
context:
space:
mode:
Diffstat (limited to 'glx/glxext.c')
-rw-r--r--glx/glxext.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/glx/glxext.c b/glx/glxext.c
index bdacf8865..520eb2e3f 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -150,12 +150,18 @@ void __glXAddToContextList(__GLXcontext *cx)
void __glXRemoveFromContextList(__GLXcontext *cx)
{
- __GLXcontext *c, **prev;
+ __GLXcontext *c, *prev;
- prev = &glxAllContexts;
- for (c = glxAllContexts; c; c = c->next)
- if (c == cx)
- *prev = c->next;
+ if (cx == glxAllContexts)
+ glxAllContexts = cx->next;
+ else {
+ prev = glxAllContexts;
+ for (c = glxAllContexts; c; c = c->next) {
+ if (c == cx)
+ prev->next = c->next;
+ prev = c;
+ }
+ }
}
/*