[Insight-users] BCB5 and itk - please help
Dean Inglis
dean.inglis@on.aibn.com
Wed, 19 Feb 2003 08:51:19 -0500
John,
in the scope of the form's constructor you can do this:
filter = FilterType::New();
filter = 0;
you cannot do this:
filter = FilterType::New();
filter->UnRegister();
without incurring an error at app exit:
77EAB2F0 C:\WINNT\system32\KERNEL32.dll
00476463 ___raiseDebuggerException
0046E0B0 ___DefHandler
77F8E440 ntdll.dll
77F8E4DB ntdll.dll
77FA0316 ntdll.dll
0040268D itk::SmartPointer<itk::BinomialBlurImageFilter<itk::Image<float,
2>, itk::Image<float, 2> >
>::~SmartPointer<itk::BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> > >(this=:00C42D88)
0040273A TForm1::~TForm1(this=:00C42AB4)
00451A9D Classes::TComponent::DestroyComponents
0047545B __init_exit_proc
004754AA __cleanup
0047476C _exit
00475680 __startup
using UnRegister and assigning null in the form's destructor:
__fastcall TForm1::~TForm1() { filter->UnRegister(); filter = 0; }
causes:
77EAB2F0 C:\WINNT\system32\KERNEL32.dll
00476477 ___raiseDebuggerException
0046E0C4 ___DefHandler
77F8E440 ntdll.dll
77F8E4DB ntdll.dll
77FA0316 ntdll.dll
77F85BD1 ntdll.dll
0041DA9D itk::TimeStamp::Modified
00417649 itk::Object::Modified
0041302D itk::DataObject::DisconnectSource
0041B137 itk::ProcessObject::~ProcessObject
00403D1F itk::ImageSource<itk::Image<float, 2>
>::~ImageSource<itk::Image<float, 2> >(this=:00C43060)
00405A73 itk::ImageToImageFilter<itk::Image<float, 2>, itk::Image<float, 2>
>::~ImageToImageFilter<itk::Image<float, 2>, itk::Image<float, 2>
>(this=:00C43060)
00403CB7 itk::BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> >::~BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> >(this=:00C43060)
0041554E itk::LightObject::UnRegister
00417C25 itk::Object::UnRegister
0040271A TForm1::~TForm1(this=:00C42AB4)
00451AB1 Classes::TComponent::DestroyComponents
0047546F __init_exit_proc
004754BE __cleanup
00474780 _exit
00475694 __startup
using UnRegister by itself:
__fastcall TForm1::~TForm1() { filter->UnRegister(); }
causes:
77EAB2F0 C:\WINNT\system32\KERNEL32.dll
00476463 ___raiseDebuggerException
0046E0B0 ___DefHandler
77F8E440 ntdll.dll
77F8E4DB ntdll.dll
77FA0316 ntdll.dll
77F85BD1 ntdll.dll
0041DA89 itk::TimeStamp::Modified
00417635 itk::Object::Modified
00413019 itk::DataObject::DisconnectSource
0041B123 itk::ProcessObject::~ProcessObject
00403D0B itk::ImageSource<itk::Image<float, 2>
>::~ImageSource<itk::Image<float, 2> >(this=:00C43060)
00405A5F itk::ImageToImageFilter<itk::Image<float, 2>, itk::Image<float, 2>
>::~ImageToImageFilter<itk::Image<float, 2>, itk::Image<float, 2>
>(this=:00C43060)
00403CA3 itk::BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> >::~BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> >(this=:00C43060)
0041553A itk::LightObject::UnRegister
00417C11 itk::Object::UnRegister
0040271A TForm1::~TForm1(this=:00C42AB4)
00451A9D Classes::TComponent::DestroyComponents
0047545B __init_exit_proc
004754AA __cleanup
0047476C _exit
00475680 __startup
assigning null:
__fastcall TForm1::~TForm1() { filter = 0; }
causes:
77EAB2F0 C:\WINNT\system32\KERNEL32.dll
0047644F ___raiseDebuggerException
0046E09C ___DefHandler
77F8E440 ntdll.dll
77F8E4DB ntdll.dll
77FA0316 ntdll.dll
77F85BD1 ntdll.dll
0041DA75 itk::TimeStamp::Modified
00417621 itk::Object::Modified
00413005 itk::DataObject::DisconnectSource
0041B10F itk::ProcessObject::~ProcessObject
00403CF7 itk::ImageSource<itk::Image<float, 2>
>::~ImageSource<itk::Image<float, 2> >(this=:00C43060)
00405A4B itk::ImageToImageFilter<itk::Image<float, 2>, itk::Image<float, 2>
>::~ImageToImageFilter<itk::Image<float, 2>, itk::Image<float, 2>
>(this=:00C43060)
00403C8F itk::BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> >::~BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> >(this=:00C43060)
00415526 itk::LightObject::UnRegister
00417BFD itk::Object::UnRegister
0040261A itk::SmartPointer<itk::BinomialBlurImageFilter<itk::Image<float,
2>, itk::Image<float, 2> > >::operator =(this=:00C42D88, r=NULL)
0040270F TForm1::~TForm1(this=:00C42AB4)
00451A89 Classes::TComponent::DestroyComponents
00475447 __init_exit_proc
00475496 __cleanup
00474758 _exit
0047566C __startup
doing nothing (hoping for auto destruction):
__fastcall TForm1::~TForm1() { return; }
causes:
77EAB2F0 C:\WINNT\system32\KERNEL32.dll
0047643B ___raiseDebuggerException
0046E088 ___DefHandler
77F8E440 ntdll.dll
77F8E4DB ntdll.dll
77FA0316 ntdll.dll
77F85BD1 ntdll.dll
0041DA61 itk::TimeStamp::Modified
0041760D itk::Object::Modified
00412FF1 itk::DataObject::DisconnectSource
0041B0FB itk::ProcessObject::~ProcessObject
00403CE3 itk::ImageSource<itk::Image<float, 2>
>::~ImageSource<itk::Image<float, 2> >(this=:00C43060)
00405A37 itk::ImageToImageFilter<itk::Image<float, 2>, itk::Image<float, 2>
>::~ImageToImageFilter<itk::Image<float, 2>, itk::Image<float, 2>
>(this=:00C43060)
00403C7B itk::BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> >::~BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> >(this=:00C43060)
00415512 itk::LightObject::UnRegister
00417BE9 itk::Object::UnRegister
004026A2 itk::SmartPointer<itk::BinomialBlurImageFilter<itk::Image<float,
2>, itk::Image<float, 2> > >::UnRegister(this=:00C42D88)
00402671 itk::SmartPointer<itk::BinomialBlurImageFilter<itk::Image<float,
2>, itk::Image<float, 2> >
>::~SmartPointer<itk::BinomialBlurImageFilter<itk::Image<float, 2>,
itk::Image<float, 2> > >(this=:00C42D88)
00402712 TForm1::~TForm1(this=:00C42AB4)
00451A75 Classes::TComponent::DestroyComponents
00475433 __init_exit_proc
00475482 __cleanup
00474744 _exit
00475658 __startup
Is there some other way to destroy an itk object? i.e., it appears that the
SmartPointer
can be deleted before app exit by calling UnRegister in the form's
destructor, but how do you
destruct the filter itself???
Dean
-----Original Message-----
From: John Biddiscombe [mailto:john.biddiscombe@mirada-solutions.com]
Sent: February 19, 2003 6:30 AM
To: dean.inglis@on.aibn.com; insight-users@public.kitware.com
Subject: [Insight-users] BCB5 and itk - please help
Dean
Does it still crash if you do this...
filter = FilterType::New();
filter->Unregister();
filter = NULL;
ie explicitly delete the filter and set the pointer to null before exit.
JB