Skip to content

Commit df7fd1c

Browse files
committed
Bug 3195: Fixed SBML import of function parameters.
1 parent 50c549b commit df7fd1c

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

copasi/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ if (APPLE AND CMAKE_GENERATOR STREQUAL "Xcode" OR DISABLE_CORE_OBJECT_LIBRARY)
263263
endif (ENABLE_OMP)
264264
else()
265265
add_library (libCOPASISE-core OBJECT ${COPASI_SOURCES} ${COPASI_HEADERS})
266-
# target_compile_options(libCOPASISE-core PRIVATE -Werror -Wall -Wextra -Wsuggest-override)
266+
target_compile_options(libCOPASISE-core PRIVATE -fstack-protector-all)
267267
target_link_libraries(libCOPASISE-core
268268
${CROSSGUID_LIBRARY}
269269
RAPTOR::RAPTOR

copasi/OpenMP/CRandomContext.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,23 @@ CRandomContext::CRandomContext(const bool & parallel)
1010
{}
1111

1212
CRandomContext::~CRandomContext()
13-
{}
13+
{
14+
if (Base::master())
15+
{
16+
delete Base::master();
17+
Base: master() = NULL;
18+
}
19+
}
1420

1521
void CRandomContext::init(CRandom::Type type, unsigned C_INT32 seed)
1622
{
1723
Base::init();
1824

1925
if (Base::master())
20-
delete Base::master();
26+
{
27+
delete Base::master();
28+
Base: master() = NULL;
29+
}
2130

2231
Base::setMaster(nullptr);
2332

copasi/model/CReaction.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ CFunction * CReaction::createFunctionFromExpression(const std::string & infix)
717717
continue;
718718

719719
// Check whether we have compartment with that name
720-
for (const CCompartment * pCompartment : mChemEq.getCompartments())
720+
for (const CCompartment * pCompartment : mChemEq.getCompartments())
721721
if (pCompartment->getObjectName() == "Name")
722722
{
723723
it->setUsage(CFunctionParameter::Role::VOLUME);
@@ -1712,7 +1712,7 @@ CEvaluationNodeVariable* CReaction::object2variable(const CEvaluationNodeObject*
17121712
const CModel * CReaction::getFirstCModelOrDefault(std::map< const CDataObject *, SBase * > & copasi2sbmlmap)
17131713
{
17141714

1715-
for (auto & pair : copasi2sbmlmap)
1715+
for (auto & pair : copasi2sbmlmap)
17161716
{
17171717
const CModel * pModel = dynamic_cast<const CModel*>(pair.first->getObjectAncestor("Model"));
17181718

@@ -1866,16 +1866,15 @@ CFunction * CReaction::setFunctionFromExpressionTree(const CExpression & express
18661866
{
18671867
if (SBMLImporter::areEqualFunctions(pExistingFunction, pTmpFunction))
18681868
{
1869-
1870-
setFunction(pExistingFunction);
1871-
18721869
// The functions and their signature are equal however the role of the variables
18731870
// might not be defined for the existing function if this is the first time it is used
1874-
mpFunction->setReversible(pTmpFunction->isReversible());
1875-
mpFunction->getVariables() = pTmpFunction->getVariables();
1871+
pExistingFunction->setReversible(pTmpFunction->isReversible());
1872+
pExistingFunction->getVariables() = pTmpFunction->getVariables();
18761873

18771874
pdelete(pTmpFunction);
18781875

1876+
setFunction(pExistingFunction);
1877+
18791878
// we still need to do the mapping, otherwise global parameters might not be mapped
18801879
it = replacementMap.begin();
18811880

0 commit comments

Comments
 (0)