Was this actually causing issues?  The Plugins, CPPTPG's and TPGDescriptor objects are all participating in 'reference counting'.  I.e. the 'release()' method is just saying "I don't need this object anymore" and it checks the reference count and only deletes the object if it was the last to be using it.  The CppTPGDescriptorWrapper class that also references this plugin *should* still own a reference to this plugin so it wont actually be deleted until its done with it.

Check out the 3rd figure in the "CppPlugin architecture" section of the design document; it describes the dependencies of the reference counting classes.

The reason all objects are being released here and re-opened again later is so that the User (a TPG Dev) can reload the DLL/SO file to get a new version of the TPG without restarting FreeCAD.  This feature isn't complete yet but I would like to keep that within the design.