[Insight-developers] LightObject Destructor and Exception Safety
Luis Ibanez
luis.ibanez at kitware.com
Thu Apr 5 08:48:03 EDT 2007
This exception seems to be akin to the VTK_DEBUG_LEAKS
feature of VTK which is of course a feature to use only
during development.
I would suggest to keep the exception but to surround it
with conditional code that is enabled via a CMake Advanced
flag. Just like it is done in VTK.
The flag could be called:
ITK_DEBUG_MEMORY_LEAKS
The flag should be OFF by default.
Developers of new classes could still enable the flag
in order to get an error message when they are not
managing references correctly.
My 2 Cents,
Luis
-------------------------
kent williams wrote:
> I've actually seen this exception thrown a few times and it seems like when
> I was new to ITK, I created an automatic instance of a descendent class of
> itk::LightProcessObject. I don't remember which class, though -- most of
> the commonly used ITK classes have protected constructors.
>
> I also saw this once as the result (I believe) of a gcc compiler bug in a
> function returning a smart pointer, but I don't remember the circumstances
> there either.
>
> At any rate, a properly written program would never throw this exception. I
> seem to write incorrect programs and then turn them into correct ones as my
> SOP.
>
> On 4/4/07 2:57 PM, "Brad King" <brad.king at kitware.com> wrote:
>
>
>>Bill Lorensen wrote:
>>
>>>Has this exception ever been thrown? If not, then we can:
>>>
>>>1) remove the test
>>>2) issue a warning
>>>3) leave it there with a comment
>>
>>I've never seen it but I haven't messed with reference counts too much.
>> I think the SmartPointer keeps things pretty safe. Since there is
>>something wrong with a program that would produce the error anyway I
>>think printing a message is okay. I'll change it to use itkWarningMacro
>>and we can change it to something else if others prefer.
>>
>>-Brad
>>_______________________________________________
>>Insight-developers mailing list
>>Insight-developers at itk.org
>>http://www.itk.org/mailman/listinfo/insight-developers
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>
More information about the Insight-developers
mailing list