From 3f3df652c678e941f33644123da342fbd2a77ea5 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 27 Feb 2012 18:12:24 +0000 Subject: [PATCH] Fixed a bug in the assignment operator of class vcs_VolPhase m_numSpecies was used before being updated, which could lead to a segmentation fault when resizing m_formulaMatrix to be M-by-zero. --- src/equil/vcs_VolPhase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equil/vcs_VolPhase.cpp b/src/equil/vcs_VolPhase.cpp index b1878e23f..ce08e4e08 100644 --- a/src/equil/vcs_VolPhase.cpp +++ b/src/equil/vcs_VolPhase.cpp @@ -157,6 +157,7 @@ vcs_VolPhase& vcs_VolPhase::operator=(const vcs_VolPhase& b) ChargeNeutralityElement = b.ChargeNeutralityElement; p_VCS_UnitsFormat = b.p_VCS_UnitsFormat; p_activityConvention= b.p_activityConvention; + m_numSpecies = b.m_numSpecies; m_numElemConstraints = b.m_numElemConstraints; m_elementNames.resize(b.m_numElemConstraints); for (size_t e = 0; e < b.m_numElemConstraints; e++) { @@ -172,7 +173,6 @@ vcs_VolPhase& vcs_VolPhase::operator=(const vcs_VolPhase& b) } m_speciesUnknownType = b.m_speciesUnknownType; m_elemGlobalIndex = b.m_elemGlobalIndex; - m_numSpecies = b.m_numSpecies; PhaseName = b.PhaseName; m_totalMolesInert = b.m_totalMolesInert; m_isIdealSoln = b.m_isIdealSoln;