Blob Blame History Raw
From 604ac8f46a85a5c68b00751baa699d770f754e1c Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Thu, 3 Jun 2021 17:51:01 +0200
Subject: [PATCH xserver 27/27] glx: Set ContextTag for all contexts

Currently, xorgGlxMakeCurrent() would set the context tag only for
indirect GLX contexts.

However, several other places expect to find a context for the tag or
they would raise a GLXBadContextTag error, such as WaitGL() or WaitX().

Set the context tag for direct contexts as well, to avoid raising an
error and possibly killing the client.

Thanks to Erik Kurzinger <ekurzinger@nvidia.com> for spotting the issue.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit c468d34c7208c9041f9c077b54a00ae9cccad6a3)
---
 glx/glxcmds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 1b9ad6d14..bd62e913c 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -664,9 +664,10 @@ xorgGlxMakeCurrent(ClientPtr client, GLXContextTag tag, XID drawId, XID readId,
         }
 
         glxc->currentClient = client;
-        glxServer.setContextTagPrivate(client, newContextTag, glxc);
     }
 
+    glxServer.setContextTagPrivate(client, newContextTag, glxc);
+
     if (prevglxc) {
         prevglxc->currentClient = NULL;
         if (!prevglxc->idExists) {
-- 
2.31.1