summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-11-30 13:08:19 +0100
committerPierre Ossman <ossman@cendio.se>2015-11-30 13:09:46 +0100
commit5d3f7d1c716041b09de6c0dbf44f5c318d805495 (patch)
tree6b22b4f7f48773a68000c8e47434453bc10a5020
parent357b1a448380bf2900cc0ddcd5f31fa685ec2230 (diff)
downloadtigervnc-5d3f7d1c716041b09de6c0dbf44f5c318d805495.tar.gz
tigervnc-5d3f7d1c716041b09de6c0dbf44f5c318d805495.zip
Gracefully handle empty CopyArea operations
(cherry picked from commit db821a236ff90db5251f99331e37f4fac85654a6)
-rw-r--r--unix/xserver/hw/vnc/vncHooks.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/unix/xserver/hw/vnc/vncHooks.c b/unix/xserver/hw/vnc/vncHooks.c
index eee26820..886c6466 100644
--- a/unix/xserver/hw/vnc/vncHooks.c
+++ b/unix/xserver/hw/vnc/vncHooks.c
@@ -1111,19 +1111,26 @@ static RegionPtr vncHooksCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
GCPtr pGC, int srcx, int srcy, int w, int h,
int dstx, int dsty)
{
- BoxRec box;
RegionRec dst, src, changed;
RegionPtr ret;
GC_OP_PROLOGUE(pGC, CopyArea);
- box.x1 = dstx + pDst->x;
- box.y1 = dsty + pDst->y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
+ // Apparently this happens now and then...
+ if ((w == 0) || (h == 0))
+ REGION_NULL(pGC->pScreen, &dst);
+ else {
+ BoxRec box;
+
+ box.x1 = dstx + pDst->x;
+ box.y1 = dsty + pDst->y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+
+ REGION_INIT(pGC->pScreen, &dst, &box, 0);
+ }
- REGION_INIT(pGC->pScreen, &dst, &box, 0);
REGION_INTERSECT(pGC->pScreen, &dst, &dst, pGC->pCompositeClip);
// The source of the data has to be something that's on screen.
@@ -1131,6 +1138,8 @@ static RegionPtr vncHooksCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
if ((pSrc->pScreen == pGC->pScreen) &&
((pSrc->type == DRAWABLE_WINDOW) ||
(pSrc == &pGC->pScreen->GetScreenPixmap(pGC->pScreen)->drawable))) {
+ BoxRec box;
+
box.x1 = srcx + pSrc->x;
box.y1 = srcy + pSrc->y;
box.x2 = box.x1 + w;