summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/except.c
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib/src/pj/except.c')
-rw-r--r--pjlib/src/pj/except.c8
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