Skip to content

Commit

Permalink
Merge pull request #44 from WISE-Developers/working/scenario_leak
Browse files Browse the repository at this point in the history
Delete the placeholder scenario
  • Loading branch information
tredpath authored Feb 11, 2023
2 parents 8fa2c71 + 5b2bdc5 commit d469b69
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions WISE_Project/cpp/Scenario.proto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ auto Project::ScenarioCollection::deserialize(const google::protobuf::Message& p

auto s = FirstScenario();
RemoveScenario(s);
ScenarioCollection* retval = this;

ScenarioSerializationData data(m_project->m_gridFilterCollection,
m_project->m_vectorCollection, m_project->m_assetCollection, m_project->m_targetCollection, m_project->m_weatherCollection, m_project->m_fireCollection);
Expand Down Expand Up @@ -1758,13 +1759,15 @@ auto Project::ScenarioCollection::deserialize(const google::protobuf::Message& p
/// <type>internal</type>
if (valid)
valid->add_child_validation("WISE.ProjectProto.ScenarioCollection", strprintf("scenarios[%d]", i), validation::error_level::SEVERE, validation::id::cannot_allocate, "CLSID_CWFGM_scenario");
return nullptr;
retval = nullptr;
break;
}
AddScenario(scenario);
if (!scenario->deserialize(scen, v, "scenarioCopy", &data)) {
weak_assert(false);
delete scenario;
return nullptr;
retval = nullptr;
break;
}
}
//new scenario
Expand All @@ -1781,12 +1784,14 @@ auto Project::ScenarioCollection::deserialize(const google::protobuf::Message& p
/// <type>internal</type>
if (valid)
valid->add_child_validation("WISE.ProjectProto.ScenarioCollection", strprintf("scenarios[%d]", i), validation::error_level::SEVERE, validation::id::cannot_allocate, "CLSID_CWFGM_scenario");
return nullptr;
retval = nullptr;
break;
}
AddScenario(scenario);
if (!scenario->deserialize(scen, v, "scenario", &data)) {
weak_assert(false);
return nullptr;
retval = nullptr;
break;
}
}
}
Expand Down Expand Up @@ -1822,13 +1827,15 @@ auto Project::ScenarioCollection::deserialize(const google::protobuf::Message& p
/// <type>internal</type>
if (valid)
valid->add_child_validation("WISE.ProjectProto.ScenarioCollection", strprintf("scenarios[%d]", i), validation::error_level::SEVERE, validation::id::cannot_allocate, "CLSID_CWFGM_scenario");
return nullptr;
retval = nullptr;
break;
}
AddScenario(scenario);
if (!scenario->deserialize(scen, v, "scenarioCopy", &data)) {
weak_assert(false);
delete scenario;
return nullptr;
retval = nullptr;
break;
}
}
//new scenario
Expand All @@ -1845,12 +1852,14 @@ auto Project::ScenarioCollection::deserialize(const google::protobuf::Message& p
/// <type>internal</type>
if (valid)
valid->add_child_validation("WISE.ProjectProto.ScenarioCollection", strprintf("scenarios[%d]", i), validation::error_level::SEVERE, validation::id::cannot_allocate, "CLSID_CWFGM_scenario");
return nullptr;
retval = nullptr;
break;
}
AddScenario(scenario);
if (!scenario->deserialize(scen, v, "scenario", &data)) {
weak_assert(false);
return nullptr;
retval = nullptr;
break;
}
}
}
Expand All @@ -1861,5 +1870,5 @@ auto Project::ScenarioCollection::deserialize(const google::protobuf::Message& p
AddScenario(s);
} else
delete s;
return this;
return retval;
}

0 comments on commit d469b69

Please sign in to comment.