Fix potential segmentation fault and invalid read.
Cherry-pick of trunk r2676.
This commit is contained in:
parent
0590c6c1a3
commit
ee736fb306
3 changed files with 28 additions and 2 deletions
|
|
@ -120,6 +120,16 @@ public:
|
|||
const XML_Node* const phaseNode_ptr);
|
||||
//@}
|
||||
|
||||
//! Initialize the internal shallow pointers in this object
|
||||
/*!
|
||||
* There are a bunch of internal shallow pointers that point to the owning
|
||||
* VPStandardStateTP and SpeciesThermo objects. This function reinitializes
|
||||
* them. This function is called like an onion.
|
||||
*
|
||||
* @param vp_ptr Pointer to the VPStandardStateTP standard state
|
||||
* @param sp_ptr Pointer to the SpeciesThermo standard state
|
||||
*/
|
||||
virtual void initAllPtrs(VPStandardStateTP* vp_ptr, SpeciesThermo* sp_ptr);
|
||||
private:
|
||||
//! Shallow pointer to the water object
|
||||
PDSS_Water* m_waterSS;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, const std::string& id_)
|
|||
}
|
||||
|
||||
MetalSHEelectrons::MetalSHEelectrons(const MetalSHEelectrons& right) :
|
||||
SingleSpeciesTP()
|
||||
SingleSpeciesTP(),
|
||||
xdef_(0)
|
||||
{
|
||||
operator=(right);
|
||||
}
|
||||
|
|
@ -99,7 +100,10 @@ MetalSHEelectrons::operator=(const MetalSHEelectrons& right)
|
|||
}
|
||||
|
||||
delete xdef_;
|
||||
xdef_ = new XML_Node(*right.xdef_);
|
||||
if(right.xdef_)
|
||||
{
|
||||
xdef_ = new XML_Node(*right.xdef_);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,6 +299,18 @@ VPSSMgr_Water_HKFT::createInstallPDSS(size_t k, const XML_Node& speciesNode,
|
|||
return kPDSS;
|
||||
}
|
||||
|
||||
void
|
||||
VPSSMgr_Water_HKFT::initAllPtrs(VPStandardStateTP* vp_ptr,
|
||||
SpeciesThermo* sp_ptr)
|
||||
{
|
||||
VPSSMgr::initAllPtrs(vp_ptr, sp_ptr);
|
||||
m_waterSS = dynamic_cast<PDSS_Water*>(m_vptp_ptr->providePDSS(0));
|
||||
if (!m_waterSS) {
|
||||
throw CanteraError("VPSSMgr_Water_ConstVol::initAllPtrs",
|
||||
"bad dynamic cast");
|
||||
}
|
||||
}
|
||||
|
||||
PDSS_enumType VPSSMgr_Water_HKFT::reportPDSSType(int k) const
|
||||
{
|
||||
return cPDSS_UNDEF;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue