summaryrefslogtreecommitdiff
path: root/dix/gc.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-03-15 23:53:53 -0700
committerEric Anholt <eric@anholt.net>2014-03-26 12:58:40 -0700
commitae87b536155207e6e28b68963593a7ab09792e08 (patch)
treeac2427c4925f2f5d4b3be9f942f74b5f409b916f /dix/gc.c
parent2e040f41de18f4d46e649561b6efb043195fdfbe (diff)
dix: Allow NULL stipple in ChangeGC
miOpqStipDrawable resets the stipple after painting. When that stipple was NULL, ChangeGC needs to handle that and not crash. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'dix/gc.c')
-rw-r--r--dix/gc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/dix/gc.c b/dix/gc.c
index efe6d6090..88d650121 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -261,12 +261,14 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion)
case GCStipple:
NEXT_PTR(PixmapPtr, pPixmap);
- if ((pPixmap->drawable.depth != 1) ||
- (pPixmap->drawable.pScreen != pGC->pScreen)) {
+ if (pPixmap && ((pPixmap->drawable.depth != 1) ||
+ (pPixmap->drawable.pScreen != pGC->pScreen)))
+ {
error = BadMatch;
}
else {
- pPixmap->refcnt++;
+ if (pPixmap)
+ pPixmap->refcnt++;
if (pGC->stipple)
(*pGC->pScreen->DestroyPixmap) (pGC->stipple);
pGC->stipple = pPixmap;