Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHIEstimator] delete itk smart pointer the correct way #140

Open
dboun opened this issue Mar 11, 2020 · 0 comments
Open

[PHIEstimator] delete itk smart pointer the correct way #140

dboun opened this issue Mar 11, 2020 · 0 comments

Comments

@dboun
Copy link
Collaborator

dboun commented Mar 11, 2020

Let me preface this by saying that I'm not exactly sure about this, but here it goes.

  1. Turns out the correct way to delete itk SmartPointer(s) is smartPointer = NULL; [ITK REFERNCE - look at "Coding Style">"DO NOT"]

  2. mitk::Pointer(s) are typedef'd itk::SmartPointer(s)

  3. [HERE IN PHIEstimator] there is a maskImageTmp->Delete(); which should probably be mitkImageTmp = NULL.

  4. I think the "issue" is that if you call Delete() the smart pointer will be destroyed regardless of the number of references it holds, while the = NULL just decreases the reference counter by one and deletes it only if it reaches 0. It doesn't look like it matters here, but we should stick to the correct ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant