From 918923e285f4e269a257bb5be4d3c8a50174aad0 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 10 Jun 2009 15:13:45 +1000 Subject: [PATCH] glx: fix open-coded linked list removal function OMG stab stab stab, YALL. removal function was made of crack, actually truncated the list from the one after the find point. However fixing this makes glean makecurrent fail with a GLX error. --- glx/glxext.c | 16 +++++++++++----- 1 file 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; + } + } } /*