Commit f2a37288 authored by Ben Byer's avatar Ben Byer

Patch to rootless code that should fix many crashes. Credit to Ken Thomases

at CodeWeavers for the patch.  From his description:

Fix a display bug with the X server.  The Generic Rootless extension
installs overrides for certain GC (graphics context) operations.  Within
these overrides, they temporarily uninstall themselves, perform their work,
and then reinstall themselves.  Except sometimes they would return early
and wouldn't reinstall themselves when they should.  Now they do in all cases.

Fix a bug in RootlessCopyWindow where early returns could leave the screen's
dispatch table entry for CopyWindow unwrapped.  We think that this is
another case (hopefully the last) of the rootless drawing bug.
parent 338c1aed
......@@ -413,10 +413,12 @@ static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
#define GC_IS_ROOT(pDst) ((pDst)->type == DRAWABLE_WINDOW \
&& IsRoot ((WindowPtr) (pDst)))
#define GC_SKIP_ROOT(pDst) \
#define GC_SKIP_ROOT(pDst, pGC) \
do { \
if (GC_IS_ROOT (pDst)) \
if (GC_IS_ROOT (pDst)) { \
GCOP_WRAP(pGC); \
return; \
} \
} while (0)
......@@ -426,7 +428,7 @@ RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("fill spans start ");
if (nInit <= 0) {
......@@ -482,7 +484,7 @@ RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
int nspans, int sorted)
{
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("set spans start ");
if (nspans <= 0) {
......@@ -533,7 +535,7 @@ RootlessPutImage(DrawablePtr dst, GCPtr pGC,
BoxRec box;
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("put image start ");
RootlessStartDrawing((WindowPtr) dst);
......@@ -565,7 +567,10 @@ RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
GCOP_UNWRAP(pGC);
if (GC_IS_ROOT(dst) || GC_IS_ROOT(pSrc))
{
GCOP_WRAP(pGC);
return NULL; /* nothing exposed */
}
RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst);
......@@ -615,7 +620,10 @@ static RegionPtr RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst,
GCOP_UNWRAP(pGC);
if (GC_IS_ROOT(dst) || GC_IS_ROOT(pSrc))
{
GCOP_WRAP(pGC);
return NULL; /* nothing exposed */
}
RL_DEBUG_MSG("copy plane start ");
......@@ -652,7 +660,7 @@ static void RootlessPolyPoint(DrawablePtr dst, GCPtr pGC,
int mode, int npt, DDXPointPtr pptInit)
{
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("polypoint start ");
RootlessStartDrawing((WindowPtr) dst);
......@@ -746,7 +754,7 @@ static void RootlessPolylines(DrawablePtr dst, GCPtr pGC,
int mode, int npt, DDXPointPtr pptInit)
{
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("poly lines start ");
RootlessStartDrawing((WindowPtr) dst);
......@@ -821,7 +829,7 @@ static void RootlessPolySegment(DrawablePtr dst, GCPtr pGC,
int nseg, xSegment *pSeg)
{
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("poly segment start (win 0x%x)", dst);
RootlessStartDrawing((WindowPtr) dst);
......@@ -892,7 +900,7 @@ static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC,
int nRects, xRectangle *pRects)
{
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("poly rectangle start ");
RootlessStartDrawing((WindowPtr) dst);
......@@ -953,7 +961,7 @@ static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC,
static void RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs)
{
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("poly arc start ");
RootlessStartDrawing((WindowPtr) dst);
......@@ -1009,7 +1017,7 @@ static void RootlessFillPolygon(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("fill poly start (win 0x%x, fillStyle 0x%x)", dst,
pGC->fillStyle);
......@@ -1083,7 +1091,7 @@ static void RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("fill rect start (win 0x%x, fillStyle 0x%x)", dst,
pGC->fillStyle);
......@@ -1138,7 +1146,7 @@ static void RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("fill arc start ");
if (narcsInit > 0) {
......@@ -1193,7 +1201,7 @@ static void RootlessImageText8(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("imagetext8 start ");
if (count > 0) {
......@@ -1247,7 +1255,10 @@ static int RootlessPolyText8(DrawablePtr dst, GCPtr pGC,
GCOP_UNWRAP(pGC);
if (GC_IS_ROOT(dst))
{
GCOP_WRAP(pGC);
return 0;
}
RL_DEBUG_MSG("polytext8 start ");
......@@ -1285,7 +1296,7 @@ static void RootlessImageText16(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("imagetext16 start ");
if (count > 0) {
......@@ -1339,7 +1350,10 @@ static int RootlessPolyText16(DrawablePtr dst, GCPtr pGC,
GCOP_UNWRAP(pGC);
if (GC_IS_ROOT(dst))
{
GCOP_WRAP(pGC);
return 0;
}
RL_DEBUG_MSG("polytext16 start ");
......@@ -1378,7 +1392,7 @@ static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("imageglyph start ");
if (nglyphInit > 0) {
......@@ -1439,7 +1453,7 @@ static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
CharInfoPtr *ppci, pointer pglyphBase)
{
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("polyglyph start ");
RootlessStartDrawing((WindowPtr) dst);
......@@ -1485,7 +1499,7 @@ RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
BoxRec box;
GCOP_UNWRAP(pGC);
GC_SKIP_ROOT(dst);
GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("push pixels start ");
RootlessStartDrawing((WindowPtr) dst);
......
......@@ -836,13 +836,13 @@ RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
top = TopLevelParent(pWin);
if (top == NULL) {
RL_DEBUG_MSG("no parent\n");
return;
goto out;
}
winRec = WINREC(top);
if (winRec == NULL) {
RL_DEBUG_MSG("not framed\n");
return;
goto out;
}
/* Move region to window local coords */
......@@ -865,6 +865,7 @@ RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
RootlessDamageRegion(pWin, prgnSrc);
}
out:
REGION_UNINIT(pScreen, &rgnDst);
fbValidateDrawable(&pWin->drawable);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment