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 firstname.lastname@example.org