2016-08-03 12 views
2

次のコードはvtkAbstractTransformのコードです。私のアプリケーションはこの関数で壊れていますが、このコードは安全ですか?Delete関数を呼び出した後、vtkObjectのメンバー関数を呼び出すことは安全ですか?

void vtkTransformConcatenation::Concatenate(const double elements[16]) 
    { 
    // concatenate the matrix with either the Pre- or PostMatrix 
    if (this->PreMultiplyFlag) 
    { 
     if (this->PreMatrix == NULL) 
     { 
      // add the matrix to the concatenation 
      vtkSimpleTransform *mtrans = vtkSimpleTransform::New(); 
      this->Concatenate(mtrans); 
      mtrans->Delete(); // call Delete on mtrans 
      this->PreMatrixTransform = mtrans; 
      this->PreMatrix = mtrans->GetMatrix(); 
     } 
     vtkMatrix4x4::Multiply4x4(*this->PreMatrix->Element, elements, 
           *this->PreMatrix->Element); // My application crushed here. 
     ... 
    } } 

答えて

0

概念的には、削除されたオブジェクトに対して関数を呼び出すことは意味がありません。このオブジェクトを削除した後、この割り当てを削除した後、この割り当てには通常、不要な値(NULL値の可能性もあります)が追加されていました。この変数が使用されると(私はかなり確信しています)、クラッシュが発生します。

0

番号Deleteを呼び出すと、オブジェクトが削除されることがあります。削除されたオブジェクトにアクセスすると、未定義の動作が呼び出されます。

関連する問題