Re: [Rd] Pointer ownership with GECreateDevDesc/GEDestroyDevDesc

2014-09-23 Thread Paul Murrell
This seems like the best solution (free and NULL the dev pointer in dev_Close(), BEFORE GEdestroyDevDesc() has a go). I think this should be safe because dev_Close() and GEdestroyDevDesc() are only called in one place (so your free() should always happen before GEdestroyDevDesc() and your fr

Re: [Rd] Pointer ownership with GECreateDevDesc/GEDestroyDevDesc

2014-09-22 Thread Ritch Melton
I perused the source for RStudio and noticed that they had a similar problem. I didn't think that the GEDevDesc structure was exported, but apparently this is a worthwhile workaround to the defect. void GD_Close(pDevDesc dev) { ...elided... // explicitly free and then null out the dev pointe