<p>Am 18.02.2012 07:05 schrieb "Chad Berchek" <<a href="mailto:ad100@vobarian.com">ad100@vobarian.com</a>>:<br>
><br>
> On 2/17/2012 2:26 PM, Sven Barth wrote:<br>
>><br>
>> On 17.02.2012 18:36, Jorge Aldo G. de F. Junior wrote:<br>
><br>
><br>
>>> so i am inclined to think that exceptions arent supposed to live much<br>
>>> longer after their corresponding try except handling block.<br>
>>><br>
>>> is that true ? actually, how are exceptions raised ? can i reraise one ?<br>
>><br>
>><br>
>> To make things short: yes, that is true. Exceptions are freed after<br>
>> either a except handler has handled it without reraising or after the<br>
>> "unhandled exception" handler has taken control (though in the last case<br>
>> it could be that the exception isn't freed, because the program is<br>
>> simply terminated...).<br>
><br>
><br>
> The AcquireExceptionObject function should be able to overcome this problem. It is designed to "acquire" a reference to the exception object so you sort of "own" it (actually it's reference counted; you own one refcount) and it won't be automatically freed after the except block. Be sure, then, in the destructor of Trowcolexception, to release the nested exception object.<br>
><br>
> <a href="http://www.freepascal.org/docs-html/rtl/system/acquireexceptionobject.html">http://www.freepascal.org/docs-html/rtl/system/acquireexceptionobject.html</a><br>
><br>
> <a href="http://www.freepascal.org/docs-html/rtl/system/releaseexceptionobject.html">http://www.freepascal.org/docs-html/rtl/system/releaseexceptionobject.html</a></p>
<p>This is one of those moments where I need to aknowledge that even I never stop learning ;)</p>
<p>Regards,<br>
Sven<br>
</p>