mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-31 09:10:32 +01:00
glx: Fix use after free problem
This commit is contained in:
parent
fc1daab2a2
commit
659dab6be6
1 changed files with 7 additions and 6 deletions
|
|
@ -248,12 +248,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
oldGC->currentDrawable = None;
|
||||
oldGC->currentReadable = None;
|
||||
oldGC->thread_id = 0;
|
||||
if (oldGC->xid == None && oldGC != gc)
|
||||
/* We are switching away from a context that was
|
||||
* previously destroyed, so we need to free the memory
|
||||
* for the old handle.
|
||||
*/
|
||||
oldGC->vtable->destroy(oldGC);
|
||||
}
|
||||
|
||||
if (gc) {
|
||||
|
|
@ -267,6 +261,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
__glXSetCurrentContextNull();
|
||||
}
|
||||
|
||||
if (oldGC != &dummyContext && oldGC->xid == None && oldGC != gc) {
|
||||
/* We are switching away from a context that was
|
||||
* previously destroyed, so we need to free the memory
|
||||
* for the old handle. */
|
||||
oldGC->vtable->destroy(oldGC);
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
__glXGenerateError(dpy, gc, None, ret, X_GLXMakeContextCurrent);
|
||||
return GL_FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue