fix bug related to PVStructurePtr createPVStructure(
StringArray const & fieldNames,PVFieldPtrArray const & pvFields); The old implementation created a new version of each element of pvField. The new version uses the version from pvFields. There is a new shared pointer but the new shared pointer referenced the same PVField as the original.
This commit is contained in:
@@ -72,14 +72,12 @@ PVStructure::PVStructure(StructureConstPtr const & structurePtr,
|
||||
{
|
||||
size_t numberFields = structurePtr->getNumberFields();
|
||||
StringArray fieldNames = structurePtr->getFieldNames();
|
||||
PVFieldPtrArray * xxx = const_cast<PVFieldPtrArray *>(&pvFields);
|
||||
xxx->reserve(numberFields);
|
||||
PVDataCreatePtr pvDataCreate = getPVDataCreate();
|
||||
pvFields.reserve(numberFields);
|
||||
for(size_t i=0; i<numberFields; i++) {
|
||||
xxx->push_back(pvDataCreate->createPVField(pvs[i]->getField()));
|
||||
pvFields.push_back(pvs[i]);
|
||||
}
|
||||
for(size_t i=0; i<numberFields; i++) {
|
||||
(*xxx)[i]->setParentAndName(this,fieldNames[i]);
|
||||
pvFields[i]->setParentAndName(this,fieldNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user