[Insight-users] Using non-smart pointers

David Doria daviddoria at gmail.com
Fri Dec 2 10:42:26 EST 2011


If I have a function like this:

void Test(const ImageType* input, ImageType* output)

and I create 'output' like this:

ImageType::Pointer outputImage = ImageType::New();
void Test(input, outputImage);

all is well. However, if I do this:

ImageType* outputImage = ImageType::New();
void Test(input, outputImage);

it segfaults when I try to use 'output'. Here is a demonstration of
the problem: http://www.itk.org/Wiki/ITK/Examples/Broken/Utilities/NonSmartPointers

Can anyone explain what is wrong with this?

Thanks,

David


More information about the Insight-users mailing list