[Rd] Stack imbalance warnings while using the grid package, in R 4.2

Panagiotis Skintzos @|gm@p| @end|ng |rom po@teo@net
Wed Jun 29 16:53:16 CEST 2022

Hello to all.

In ggiraph package, we are getting some warnings about "Stack imbalance 
in NextMethod" when we subclass a primitive grob and override the 
widthDetails function. This started to occur from R version 4.2 onward, 
in various platforms (linux, iOS, Windows).

You can see the bug report, where I've added a minimal reprex:

I've identified the issue in grid package. It occurs when calling 
grid.Call.graphics with C_moveTo, C_lineTo, C_lines, C_segments, 
C_arrows, C_polygon, C_path, C_circle, C_rect and C_raster at least. The 
relevant functions in grid.c have mismatches in protect/unprotect calls.

As I see in the code diff for grid.c, between R 4.1 and R 4.2, one extra 
PROTECT call was added to the above functions (L_*) but the UNPROTECT 
call at the end of the functions was not updated.
In other functions, like gridPoints for example, the UNPROTECT call has 
been updated, so the issue does not occur when overriding the pointsGrob.

I can try to submit a patch if you wish, but perhaps there are other 
functions elsewhere with the same issue that need to be checked.

Hopefully this can be resolved for the next version.

Thank you,


More information about the R-devel mailing list