[Rd] grid error: protection stack overflow

Paul Murrell p.murrell at auckland.ac.nz
Wed Nov 19 22:54:59 CET 2008


Hi


Felix Andrews wrote:
> I have isolated an error that can be reproduced by the following code.
> The same thing happens in 2.8.0pat and 2.9.0dev. It looks like the
> try() code is ending up in the display list, or something?


The problem was that the *unsuccessful* downViewport() was ending up on
the display list (which lead to an infinite loop on a display list
replay, which produced the error).  I have committed a fix to r-devel.

Thanks for the report!

Paul

p.s. A side-bug that this investigation exposed is that using try() on
graphics code can have the effect (when an error occurs) of turning off
display list recording for the device.  No solution in sight for that
bug, so best to stay away from try() for now, as your follow up email
suggested.


> library(grid)
> library(lattice)
> 
> xyplot(1:100 ~ 1:100)
> test <- try(downViewport("pageAnnotationVp"), silent = TRUE)
> downViewport(trellis.vpname("toplevel"))
> pushViewport(viewport(name = "pageAnnotationVp", yscale = c(1, 0)))
> upViewport(0)
> 
> ## resize device to trigger a couple of redraws...
> 
> Error: protect(): protection stack overflow
> 
> Enter a frame number, or 0 to exit
> 1: no.children(<environment>)
> 2: ls(children, all.names = TRUE)
> 3: try(name)
> 4: tryCatch(expr, error = function(e) {
> 5: tryCatchList(expr, classes, parentenv, handlers)
> 6: tryCatchOne(expr, names, parentenv, handlers[[1]])
> 7: doTryCatch(return(expr), name, parentenv, handler)
> 
> 
>> sessionInfo()
> R version 2.8.0 Patched (2008-11-10 r46884)
> i386-pc-mingw32
> 
> locale:
> LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252
> 
> attached base packages:
> [1] grid      stats     graphics  grDevices utils     datasets
> methods   base
> 
> other attached packages:
> [1] lattice_0.17-15
> 
> 

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-devel mailing list