Fixing a memory bug in SpiceManager

This commit is contained in:
Alexander Bock
2015-07-06 22:47:55 +02:00
parent 682e849423
commit 19540a6f21
3 changed files with 9 additions and 10 deletions
+2 -4
View File
@@ -154,10 +154,8 @@ bool SceneGraphNode::deinitialize() {
_renderable = nullptr;
}
if (_ephemeris) {
delete _ephemeris;
_ephemeris = nullptr;
}
delete _ephemeris;
_ephemeris = nullptr;
for (SceneGraphNode* child : _children) {
child->deinitialize();
+6 -5
View File
@@ -954,9 +954,10 @@ bool SpiceManager::getTerminatorEllipse(const int numberOfPoints,
double ephemerisTime,
double& targetEpoch,
glm::dvec3& observerPosition,
std::vector<psc>& terminatorPoints){
double(*tpoints)[3] = new double[numberOfPoints][3];
std::vector<psc>& terminatorPoints)
{
std::vector<std::array<double, 3>> tpoints(numberOfPoints);
// double (*tpoints)[3] = new double[numberOfPoints][3];
edterm_c(terminatorType.c_str(),
lightSource.c_str(),
@@ -968,7 +969,7 @@ bool SpiceManager::getTerminatorEllipse(const int numberOfPoints,
numberOfPoints,
&targetEpoch,
glm::value_ptr(observerPosition),
(double(*)[3])tpoints );
(double(*)[3])tpoints.data() );
bool hasError = checkForError("Error getting " + terminatorType +
"terminator for'" + target + "'");
@@ -980,7 +981,7 @@ bool SpiceManager::getTerminatorEllipse(const int numberOfPoints,
point[3] += 3;
terminatorPoints.push_back(point);
}
return true;
}