When multiple processes are using GL with indirect rendering a race condition can make drawables refcount never drop to zero.
Signed-off-by: Guilherme Quentel Melo <gqm...@gmail.com> --- glx/glxext.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/glx/glxext.c b/glx/glxext.c index e41b881..16b8039 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -469,6 +469,24 @@ __glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error) /* Make this context the current one for the GL. */ if (!cx->isDirect) { + /* + ** If we are forcing the context it means someone already called makeCurrent before. If + ** we just call makeCurrent again, the drawable of this context will be left with one + ** refcount more forever and will never be freed. + ** + ** This situation happens when there are many X clients using GL: + ** + ** 1 - client1: calls glXMakeCurrent + ** + ** 2 - client2: calls glXMakeCurrent + ** This is the first context switch for this client. So old_context_tag=0 + ** + ** 3 - client1: calls glXRender + ** For the client, its context is already current. + ** For the server side lastGLContext points to client2's context. So the execution path + ** will get here. + */ + (*cx->loseCurrent) (cx); lastGLContext = cx; if (!(*cx->makeCurrent) (cx)) { /* Bind failed, and set the error code. Bummer */ -- 2.5.0 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel