aboutsummaryrefslogtreecommitdiffstats
path: root/unix/xserver/hw/vnc/vncHooks.c
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:08:19 +0100
commitdb821a236ff90db5251f99331e37f4fac85654a6 (patch)
tree32ef978e0daa509b422d93786512660a89bd6d9a /unix/xserver/hw/vnc/vncHooks.c
parent3a35f72332bd06ab079dd46655ef56cab4de6797 (diff)
downloadtigervnc-db821a236ff90db5251f99331e37f4fac85654a6.tar.gz
tigervnc-db821a236ff90db5251f99331e37f4fac85654a6.zip
Gracefully handle empty CopyArea operations
Diffstat (limited to 'unix/xserver/hw/vnc/vncHooks.c')
-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;