[Insight-users] destruction of itk objects
John Biddiscombe
John Biddiscombe" <jbiddiscombe@skippingmouse.co.uk
Thu, 13 Feb 2003 17:18:07 -0000
is the itkImporter trying to delete it's "pointer to whatever image it
thinks it owns"? Just Guessing right now, (can you not step into the ikt
code?) - I'll have a think later...
JB
I'm sure someone like Luis will answer you with the correct explanation
before I get a change to ponder it
----- Original Message -----
From: <dean.inglis@on.aibn.com>
To: "John Biddiscombe" <jbiddiscombe@skippingmouse.co.uk>;
<insight-users@public.kitware.com>
Sent: Thursday, February 13, 2003 4:03 PM
Subject: Re: Re: [Insight-users] destruction of itk objects
> Hi John,
>
> I was hoping you would respond! Well, that
> doesn't work either. In OnCreate I have:
>
> itkImporter = ImageImportType::New();
> itkImporter->Register();
> itkImporter->DebugOn();
> itkImporter->SetGlobalWarningDisplay(true);
>
> I added a button on the form to pop up a ShowMessage
> with the reference count: clearly the itk object
> exists: GetReferenceCount = 2.
>
> In the OnDestory event,
> itkImporter->UnRegister();
> the IDE debug shows this as the problem line: it
> causes an access violation. Commenting that line
> out, and the debugger moves on to the UnRegister method in
itkSmartPointer.h:
> if(m_Pointer){ m_Pointer->UnRegister()};
>
> and the debug info never pops up.
>
> BTW, itkImporter is not connected to anything else,
> just trying to instantiate and have it destroy in a
> BCB5 gui app. Should I override the form's destructor?
>
> I've also posted to one of the Borland newsgroups.
>
> thanks,
> Dean
>
> >
> > From: "John Biddiscombe" <jbiddiscombe@skippingmouse.co.uk>
> > Date: 2003/02/13 Thu AM 10:42:36 GMT-05:00
> > To: <dean.inglis@on.aibn.com>,
> > <insight-users@public.kitware.com>
> > Subject: Re: [Insight-users] destruction of itk objects
> >
> > Dean
> >
> > > typedef itk::Image<float, 2> ImageType;
> > > typedef itk::VTKImageImport<ImageType> ImageImportType;
> > > ImageImportType::Pointer itkImporter;
> > >
> > > instantiates it in the OnCreate event:
> >
> > At the end of the OnCreate itImporter gets destroyed because it's out of
> > scope
> >
> > add
> > itkImporter->Register()
> >
> > and in OnDestroy put
> > itkImporter->UnRegister()
> >
> > to make sure it "exists" in between
> >
> > JB
> >
> >
> >
>
>