On 2/17/2012 2:26 PM, Sven Barth wrote:
On 17.02.2012 18:36, Jorge Aldo G. de F. Junior wrote:

so i am inclined to think that exceptions arent supposed to live much
longer after their corresponding try except handling block.

is that true ? actually, how are exceptions raised ? can i reraise one ?

To make things short: yes, that is true. Exceptions are freed after
either a except handler has handled it without reraising or after the
"unhandled exception" handler has taken control (though in the last case
it could be that the exception isn't freed, because the program is
simply terminated...).

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.

http://www.freepascal.org/docs-html/rtl/system/acquireexceptionobject.html

http://www.freepascal.org/docs-html/rtl/system/releaseexceptionobject.html
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to