On 12 Jul 2008, at 13:35, David Chisnall wrote:
Hi,
I'm getting this warning from some of my code:
ERROR: Removing exception handler that is not on top of the stack.
(You probably called return in an NS_DURING block.)
I am not calling return in an NS_DURING block, but I am raising an
exception in one of these blocks (the parser throws an exception to
the tokeniser, which then throws a more informative one including
source locations). Do I need to do something to remove the current
handler from the stack before I do this?
No, you don't ... If you are inside an NS_DURING block and throw an
exception, the exception is caught by that block and goes to the
NS_HANDLER at the end of the block, and the handler is the one on
top of the stack and is removed at that point.
Most likely the warning is correct, but is referring to a different
NS_DURING block to the one you think it means ... ie an NS_DURING
block in some code called indirectly be the code inside your
NS_DURING block. Maybe the problem is not even in your own code,
but inside some library code you are calling.