summaryrefslogtreecommitdiff
path: root/miext
diff options
context:
space:
mode:
authorBen Byer <bbyer@bbyer.apple.com>2007-11-08 18:49:05 -0800
committerJeremy Huddleston <jeremy@yuffie.local>2007-11-20 03:41:22 -0800
commit654d1019f358321f52ffac00d1710c3c22f129d1 (patch)
treec9742982cf8d0a89f97d6aceb6dbd340fbb45da3 /miext
parent7768c63675f26e7a323e7101687be7087bacd9ea (diff)
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.
Diffstat (limited to 'miext')
-rw-r--r--miext/rootless/rootlessGC.c50
-rw-r--r--miext/rootless/rootlessWindow.c5
2 files changed, 35 insertions, 20 deletions
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index b26f52c54..7e0778e17 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -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);
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 1aa0b7749..84aa91dbf 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -838,13 +838,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 */
@@ -867,6 +867,7 @@ RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
RootlessDamageRegion(pWin, prgnSrc);
}
+out:
REGION_UNINIT(pScreen, &rgnDst);
fbValidateDrawable(&pWin->drawable);