void NxsTaxaBlockSurrogate::ResetSurrogate() { if (ownsTaxaBlock) { if (!passedRefOfOwnedBlock) { if (taxa != NULL && nxsReader != NULL) { NxsTaxaBlockFactory * factory = nxsReader->GetTaxaBlockFactory(); if (factory) { factory->BlockError(taxa); taxa = NULL; } } if (taxa) delete taxa; } taxa = NULL; /*potential memory leak, but a reference should be held, by the nexus reader.*/ ownsTaxaBlock = false; taxaLinkStatus = NxsBlock::BLOCK_LINK_UNINITIALIZED; } newtaxa = false; passedRefOfOwnedBlock = false; }
bool NxsTaxaBlockSurrogate::SurrogateSwapEquivalentTaxaBlock(NxsTaxaBlockAPI * tb) { NxsTaxaBlockFactory * tbf = nxsReader->GetTaxaBlockFactory(); if (this->taxa && this->ownsTaxaBlock && tbf) tbf->BlockError(taxa); this->SetTaxaBlockPtr(tb, NxsBlock::BLOCK_LINK_EQUIVALENT_TO_IMPLIED); return true; }