summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorDoğukan Korkmaztürk <dkorkmazturk@nvidia.com>2022-11-22 13:43:16 -0500
committerOlivier Fourdan <fourdan@gmail.com>2022-12-09 15:10:09 +0000
commit4781f2a5a8c2c2b000374e2d87982a6701d5a6b3 (patch)
treeb8d5e2b22179c0ce9bcc9dd6361fb6dfb1bdae07 /glx
parent3852b0d10a061348ea8214fbcbef3c5c08cac0b6 (diff)
GLX: Free the tag of the old context later
In CommonMakeCurrent() function, the tag of the old context is freed before the new context is made current. This is problematic because if the CommonMakeNewCurrent() function fails, the tag of the old context ends up being removed, even though it is still active. This causes subsequent glXMakeCurrent() or glXMakeContextCurrent() requests to generate a GLXBadContextTag error. This change moves the function call that frees the old tag to a location where the result of CommonMakeNewCurrent() call is known and it is safe to free it. Signed-off-by: Doğukan Korkmaztürk <dkorkmazturk@nvidia.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/vndcmds.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/glx/vndcmds.c b/glx/vndcmds.c
index d6d8719e1..d1e088973 100644
--- a/glx/vndcmds.c
+++ b/glx/vndcmds.c
@@ -165,9 +165,6 @@ static int CommonLoseCurrent(ClientPtr client, GlxContextTagInfo *tagInfo)
tagInfo->tag, // No old context tag,
None, None, None, 0);
- if (ret == Success) {
- GlxFreeContextTag(tagInfo);
- }
return ret;
}
@@ -259,7 +256,6 @@ static int CommonMakeCurrent(ClientPtr client,
if (ret != Success) {
return ret;
}
- oldTag = NULL;
}
if (newVendor != NULL) {
@@ -270,6 +266,9 @@ static int CommonMakeCurrent(ClientPtr client,
} else {
reply.contextTag = 0;
}
+
+ GlxFreeContextTag(oldTag);
+ oldTag = NULL;
}
reply.contextTag = GlxCheckSwap(client, reply.contextTag);