s-u/Cairo — pull request #6 by chinqw (2013-12-13 21:48:02+00:00)
Title: xd->npages is set incorrect on cairotalk.c

In function CairoGD_Close, xd->npages is increased by 1 on Line 412 xd->npages++;
using xd->npages + 1 on Line 415 is incorrect.

R> img.png <- list()
R> dev <- Cairo(800, 600, type='raster', bg="white")
R> Cairo.onSave(dev, function(dev, page) {
.GlobalEnv$img.png[[page]] <- writePNG(Cairo.capture(dev)) })
NULL

R> plot(1:10, col=2)
R> plot(1:15)
format = RGB (800 x 600)
Error in .GlobalEnv$img.png[[page]] <- writePNG(Cairo.capture(dev)) :
more elements supplied than there are to replace