Fix crash with more than one screen reported by John Davidorff Pell.
This commit is contained in:
parent
081b33d73f
commit
8266a2581d
|
@ -26,7 +26,7 @@
|
||||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||||
* use or other dealings in this Software without prior written authorization.
|
* use or other dealings in this Software without prior written authorization.
|
||||||
*/
|
*/
|
||||||
/* $XdotOrg: xc/programs/Xserver/miext/rootless/accel/rlAccel.c,v 1.1 2004/09/18 00:38:29 torrey Exp $ */
|
/* $XdotOrg: xc/programs/Xserver/miext/rootless/accel/rlAccel.c,v 1.2 2004/10/25 19:09:11 torrey Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The accelerated rootless code replaces some GC operations from fb with
|
* The accelerated rootless code replaces some GC operations from fb with
|
||||||
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
typedef struct _rlAccelScreenRec {
|
typedef struct _rlAccelScreenRec {
|
||||||
CreateGCProcPtr CreateGC;
|
CreateGCProcPtr CreateGC;
|
||||||
|
CloseScreenProcPtr CloseScreen;
|
||||||
} rlAccelScreenRec, *rlAccelScreenPtr;
|
} rlAccelScreenRec, *rlAccelScreenPtr;
|
||||||
|
|
||||||
static int rlAccelScreenPrivateIndex = -1;
|
static int rlAccelScreenPrivateIndex = -1;
|
||||||
|
@ -100,6 +101,25 @@ rlCreateGC(GCPtr pGC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clean up when closing a screen on server reset
|
||||||
|
*/
|
||||||
|
static Bool
|
||||||
|
rlCloseScreen (int iScreen, ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
rlAccelScreenRec *s = RLACCELREC(pScreen);
|
||||||
|
Bool result;
|
||||||
|
|
||||||
|
// Unwrap
|
||||||
|
pScreen->CloseScreen = s->CloseScreen;
|
||||||
|
result = pScreen->CloseScreen(iScreen, pScreen);
|
||||||
|
|
||||||
|
xfree(s);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RootlessAccelInit
|
* RootlessAccelInit
|
||||||
* Called by the rootless implementation to initialize accelerated
|
* Called by the rootless implementation to initialize accelerated
|
||||||
|
@ -114,15 +134,18 @@ RootlessAccelInit(ScreenPtr pScreen)
|
||||||
if (rlAccelGeneration != serverGeneration) {
|
if (rlAccelGeneration != serverGeneration) {
|
||||||
rlAccelScreenPrivateIndex = AllocateScreenPrivateIndex();
|
rlAccelScreenPrivateIndex = AllocateScreenPrivateIndex();
|
||||||
if (rlAccelScreenPrivateIndex == -1) return FALSE;
|
if (rlAccelScreenPrivateIndex == -1) return FALSE;
|
||||||
|
rlAccelGeneration = serverGeneration;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = xalloc(sizeof(rlAccelScreenRec));
|
s = xalloc(sizeof(rlAccelScreenRec));
|
||||||
if (!s) return FALSE;
|
if (!s) return FALSE;
|
||||||
RLACCELREC(pScreen) = s;
|
RLACCELREC(pScreen) = s;
|
||||||
|
|
||||||
// Wrap the one screen function we need
|
// Wrap the screen functions we need
|
||||||
s->CreateGC = pScreen->CreateGC;
|
s->CreateGC = pScreen->CreateGC;
|
||||||
pScreen->CreateGC = rlCreateGC;
|
pScreen->CreateGC = rlCreateGC;
|
||||||
|
s->CloseScreen = pScreen->CloseScreen;
|
||||||
|
pScreen->CloseScreen = rlCloseScreen;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user