diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-08-14 10:41:00 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-08-14 10:41:00 +0000 |
commit | f5e84f87d9b090df2ca06396fdda10569058748a (patch) | |
tree | d3275b95100d7b828dc37aeb4ed12759d21ebe65 /pjlib/src/pj/except.c | |
parent | 6d4104ca50316732a7801a6d4ea0011486d1a59c (diff) |
Fixed ticket #939: Throwing exception inside exception handler will cause infinite loop (thanks Roman Puls for the report)
- exception handler is now popped from the stack immediately in PJ_THROW
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2878 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/except.c')
-rw-r--r-- | pjlib/src/pj/except.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pjlib/src/pj/except.c b/pjlib/src/pj/except.c index 66aa56e6..61c882c4 100644 --- a/pjlib/src/pj/except.c +++ b/pjlib/src/pj/except.c @@ -50,6 +50,7 @@ PJ_DEF(void) pj_throw_exception_(int exception_id) pj_assert(handler != NULL); /* This will crash the system! */ } + pj_pop_exception_handler_(handler); pj_longjmp(handler->state, exception_id); } @@ -86,14 +87,15 @@ PJ_DEF(void) pj_push_exception_handler_(struct pj_exception_state_t *rec) pj_thread_local_set(thread_local_id, rec); } -PJ_DEF(void) pj_pop_exception_handler_(void) +PJ_DEF(void) pj_pop_exception_handler_(struct pj_exception_state_t *rec) { struct pj_exception_state_t *handler; handler = (struct pj_exception_state_t *) pj_thread_local_get(thread_local_id); - pj_assert(handler != NULL); - pj_thread_local_set(thread_local_id, handler->prev); + if (handler && handler==rec) { + pj_thread_local_set(thread_local_id, handler->prev); + } } #endif |