From xie at yihui.name  Mon Feb 20 17:30:49 2017
From: xie at yihui.name (Yihui Xie)
Date: Mon, 20 Feb 2017 10:30:49 -0600
Subject: [Rd] Replaying a recorded plot (mixed base and grid) from pdf()
 in cairo_pdf() crashes R
In-Reply-To: <CANROs4dy7xvbYRAXHMQbrBjQiYrYgETUpBAAyPBk-rzOaNoWCA@mail.gmail.com>
References: <CANROs4dy7xvbYRAXHMQbrBjQiYrYgETUpBAAyPBk-rzOaNoWCA@mail.gmail.com>
Message-ID: <CANROs4cd=EhVBsn25njQv7Uea+UHy=FqL18A-wOQ7pehmjXFjg@mail.gmail.com>

A quick follow-up: I just used cairo_pdf() as the recording device,
and it crashes R as well, so it is probably not relevant to pdf() but
an issue specific to cairo_pdf().

cairo_pdf()
dev.control('enable')

library("grid")
plot(1)
grid.text("A")

res = recordPlot()
dev.off()

cairo_pdf()
replayPlot(res)
dev.off()


Regards,
Yihui
--
https://yihui.name


On Mon, Feb 20, 2017 at 10:24 AM, Yihui Xie <xie at yihui.name> wrote:
> Hi,
>
> I wonder if this is expected or I'm doing a wrong thing.
>
> pdf()
> dev.control('enable')
>
> library("grid")
> plot(1)
> grid.text("A")
>
> res = recordPlot()
> dev.off()
>
> cairo_pdf()
> replayPlot(res)
> dev.off()
>
>
>  *** caught segfault ***
> address 0x4, cause 'memory not mapped'
>
>
>> sessionInfo()
> R version 3.3.2 (2016-10-31)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: macOS Sierra 10.12.3
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] tools_3.3.2 yaml_2.1.14
>
> Regards,
> Yihui
> --
> https://yihui.name



[Rd] Replaying a recorded plot (mixed base and grid) from pdf() in cairo_pdf() crashes R
Yihui Xie