From iverson at biostat.wisc.edu  Fri May 23 04:03:02 2008
From: iverson at biostat.wisc.edu (Erik Iverson)
Date: Thu, 22 May 2008 22:03:02 -0400
Subject: [Rd] grid error message when resizing graphics window after
 tcltk loaded
In-Reply-To: <4835B69E.3050705@biostat.wisc.edu>
References: <4835B69E.3050705@biostat.wisc.edu>
Message-ID: <483625D6.1050201@biostat.wisc.edu>

I unfortunately am having a far more difficult time replicating this on 
my home computer.

 > sessionInfo()
R version 2.7.0 (2008-04-22)
i486-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

I ran the same code loop as below after loading the tcltk package, and 
resized the resulting window dozens of times before seeing the error 
message only once.  It would often not happen at all. At work, I  will 
see the message basically every time I resize the window.

Here are the main differences I can think of off the top of my head:

1) RHEL version 4 at work, Unbuntu (8.04) at home

2) Compile my own version of R at work from source, use the Ubuntu R 
packages at home, http://cran.r-project.org/bin/linux/ubuntu/

3) Cairo support not enabled at work, it is enabled at home.

If anyone else can replicate this, that would be great.  Otherwise, I am 
going to try a few more tests tomorrow at work, and will reply with the 
results.

Best,
Erik Iverson




Erik Iverson wrote:
> Dear R-devel / Dr. Murrell  -
> 
> This is similar but ultimately unrelated (I think) to something I posted 
> about in February.  See my original post here:
> 
> https://stat.ethz.ch/pipermail/r-devel/2008-February/048278.html
> 
> I start R with the --vanilla option, and run the following code.
> 
> ## BEGIN SAMPLE R CODE
> 
> library(grid)
> for(i in seq(0, 1, by = .1)) {
>   for(j in seq(0, 1, by = .1)) {
>     angle <- runif(1, 1, 180)
>     col <- sample(colors(), 1)
>     pushViewport(viewport(x = i, y= j, width = .1, height = .1,
>                           angle = angle, gp = gpar(col = col)))
>     grid.rect()
>     popViewport()
>   }
> }
> 
> ## END SAMPLE R CODE
> 
> I can then resize the resulting R Graphics Device window and everything 
> seems to work fine.
> 
> If I then do issue 'library(tcltk)', and reissue the above code, and 
> then resize the resulting window to something fairly small, I get the 
> following error that shows up at my R prompt:
> 
> Error: Cannot pop the top-level viewport (grid and graphics output mixed?)
> 
> The error seems harmless, but eventually, after doing this "enough", and 
> closing the graphics window, R may segfault,
> 
>  *** caught segfault ***
> address 0xfc, cause 'memory not mapped'
> 
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
> 
> I have tracked down the error message I am receiving with some very 
> rudimentary techniques, and narrowed it down to the L_unsetviewport 
> function defined in grid.c.  The error string in question appears two 
> places in that function, and I determined in my case that it is the 
> first instance that is actually outputting the error.  That's about as 
> far as I can take it unfortunately.
> 
> Again, this only seems to happen after I load the tcltk package.
> 
> I am running RHEL version 4 with KDE on a 32-bit Intel processor.
> 
> Here is my session info, immediately after starting R...
> 
> sessionInfo()
> R version 2.7.0 (2008-04-22)
> i686-pc-linux-gnu
> 
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C 
> 
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> 
> Thanks,
> Erik Iverson
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] grid error message when resizing graphics window after tcltk loaded
Erik Iverson