I don't think you need to delete in reverse, I never have in the past.
I've changed the function completely now in an attempt to fix it but it's saying "Segmentation Fault" which means it's trying to access something out of range according to wiki. But I don't see how :3
Code:
void Terrain::setNormals(void){
Vector Sum, Out, In, Left, Right;
for(int w = 0; w < Width-1; w++){
for(int l = 0; l < Length-1; l++){
Sum.setValue(0.0f, 0.0f, 0.0f);
if(l > 0)
Out.setValue(0.0f, Heights[w - 1][l] - Heights[w][l], -1.0f);
if(l < Length - 1)
In.setValue(0.0f, Heights[w + 1][l] - Heights[w][l], 1.0f);
if(w > 0)
Left.setValue(-1.0f, Heights[w][l - 1] - Heights[w][l], 0.0f);
if(w < Width - 1)
Right.setValue(1.0f, Heights[w][l + 1] - Heights[w][l], 0.0f);
if(w > 0 && l > 0){
Sum += Out.CrossProduct(Left);
Sum.Normalize();
}
if(w > 0 && l < Length - 1){
Sum += Left.CrossProduct(In);
Sum.Normalize();
}
if(w < Width - 1 && l < Length - 1){
Sum += In.CrossProduct(Right);
Sum.Normalize();
}
if(w < Width - 1 && l > 0){
Sum += Right.CrossProduct(Out);
Sum.Normalize();
}
Normals[w][l] = Sum;
}
}
}