[Insight-users] Crashes with native ITK in Managed C++

Dan Mueller dan.muel at gmail.com
Tue Sep 18 14:54:55 EDT 2007


Hi Young,

This is problem discussed in:
   http://www.itk.org/pipermail/insight-users/2006-October/019652.html

For some reason (which I can not figure) you must separate your ITK
code from your GUI code using separate libraries (it seems that
Windows Forms executables like to be built with /clr:pure, not mixed
mode with ITK).

HTH

Cheers, Dan

On 19/09/2007, Young-Seok Kim <ykim5forward at yahoo.com> wrote:
> Hello,
>
> I am trying to use native ITK (as opposed to ManagedITK) in Manged C++ of
> VS2005.
>  - it compiles, links fine, but crashes when runs.
> It is from the simple code - creating and allocating an image (see below).
> It actually crashes 'even before the program shows the window'.
> The error message is as following:
>
> Debug Assertion Failed!
> Program:...
> File: dbgheap.c
> Line: 1414
> Expression: _CrtIsValidHeapPointer(pUserData)
>
> It seems related to a 'bad' pointer - the comment on that file says that.
> I originally suspected that would because I created an image in a managed
> button event function (as shown below), but it is the same when I do that in
> a separate unmanaged class.
> Is there any option for this?
>
> Regards,
> Young.
>
>
> P.S.
> void Form1::btnOp_Add_Click(System::Object^ sender,
> System::EventArgs^ e)
> {
> Interface->SetOperation(ADD);
>
> // ITK Test
> typedef itk::Image<float> ImageType;
> ImageType::Pointer image = ImageType::New();
> ImageType::SizeType size;
> size[0] = 200; // size along X
> size[1] = 200; // size along Y
> size[2] = 200; // size along Z
> ImageType::RegionType region;
> region.SetSize( size );
> image->SetRegions( region );
> image->Allocate();
> }
>
>
>  ________________________________
> Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list