FDO Reference Help and The Essential FDO.
The topics in this section describe several ways that you can manager GisPtr behavior. For more information about managing GisPtr behavior, see the related topics “GisPtr <T> Class Template Reference” and “GisIDisposable Class Reference” in theDo not chain calls. If you do, returned pointers will not be released. For example, given an FdoClassDefinition* pclassDef:
psz = pclassDef ->GetProperties()->GetItem(0)->GetName())
The above code would result in two memory leaks. Instead use:
FdoPropertyDefinitionCollection* pprops = pclassDef -> GetProperties();
FdoPropertyDefinition* ppropDef = pprops->GetItem(0);
psz = propDef->GetName();
ppropDef->Release();
pprops->Release();
or (with FdoPtr):
FdoPtr<FdoPropertyDefinitionCollection> pprops = pclassDef-> GetProperties();
FdoPtr<FdoPropertyDefinition> ppropDef = pprops-> GetItem(0);
psz = propDef->GetName();
or (also with FdoPtr):
psz = FdoPtr <FdoPropertyDefinition> (FdoPtr <FdoPropertyDefinitionCollection>(pclassDef->GetProperties())-> GetItem(0))->GetName();
Assigning Return Pointer of an FDO Function Call to a Non-Smart Pointer
If you are assigning the return pointer of an FDO function call to a non-smart pointer, then you should assign that pointer to a GisPtr. For example:
GisLineString* P = gf.CreateLineString(...);
GisPtr <GisLineString> p2 = GIS_SAFE_ADDREF(p);