Tomas Kalibera
2022-Jun-29 15:18 UTC
[Rd] Stack imbalance warnings while using the grid package, in R 4.2
On 6/29/22 16:53, Panagiotis Skintzos wrote:> 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: > https://github.com/davidgohel/ggiraph/issues/224 > > 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.Thanks, yes, could you please send a patch for R-devel? So that it is clear which PROTECTions you have in mind, and that they haven't been fixed already in the meantime in R-devel (note that there have been changes recently). It doesn't matter if you don't fix them all.> Hopefully this can be resolved for the next version.Sure, PROTECT errors have very high priority. Thanks Tomas> > > Thank you, > > Panagiotis > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Panagiotis Skintzos
2022-Jun-29 19:18 UTC
[Rd] Stack imbalance warnings while using the grid package, in R 4.2
On 29/6/22 17:18, Tomas Kalibera wrote:> > Thanks, yes, could you please send a patch for R-devel? So that it is > clear which PROTECTions you have in mind, and that they haven't been > fixed already in the meantime in R-devel (note that there have been > changes recently). > > It doesn't matter if you don't fix them all. > >> Hopefully this can be resolved for the next version. > > Sure, PROTECT errors have very high priority.Fantastic, thanks. Indeed most of them have been fixed in trunk. I attach a small patch (against revision 82535) that fixes the issue for the remaining functions (L_moveTo, L_lineTo, L_lines). With that applied, all tests in ggiraph pass without any warnings. Regards, Panagiotis -------------- next part -------------- A non-text attachment was scrubbed... Name: stack_imbalance.patch Type: text/x-patch Size: 600 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20220629/749a9c23/attachment.bin>