From 2ae07b245a2d4b62d5592bc59f88cb837a362a05 Mon Sep 17 00:00:00 2001 From: Ehren Kret Date: Wed, 5 Oct 2016 19:49:46 -0700 Subject: [PATCH 1/2] Remove extra call to coffeecatch_handler_cleanup It doesn't appear this was intended to be called twice. It results in native_code_g.initialized being decremented twice so the next time a JNI call is made, coffeecatch_handler_setup_global doesn't reinitialize (because the value in initialized is now negative). --- coffeecatch.c | 1 - 1 file changed, 1 deletion(-) diff --git a/coffeecatch.c b/coffeecatch.c index a53c355..122b6f1 100644 --- a/coffeecatch.c +++ b/coffeecatch.c @@ -1397,7 +1397,6 @@ void coffeecatch_cleanup() { t->reenter--; if (t->reenter == 0) { t->ctx_is_set = 0; - coffeecatch_handler_cleanup(); } coffeecatch_handler_cleanup(); } From 958ee52123eb575bf39c1129b264e6060d261a19 Mon Sep 17 00:00:00 2001 From: Ehren Kret Date: Thu, 6 Oct 2016 19:34:26 -0700 Subject: [PATCH 2/2] Fix wrong line deleted The line outside of the renter == 0 check is the one that should have been removed. Not the one inside. --- coffeecatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coffeecatch.c b/coffeecatch.c index 122b6f1..9d7917c 100644 --- a/coffeecatch.c +++ b/coffeecatch.c @@ -1397,8 +1397,8 @@ void coffeecatch_cleanup() { t->reenter--; if (t->reenter == 0) { t->ctx_is_set = 0; + coffeecatch_handler_cleanup(); } - coffeecatch_handler_cleanup(); } sigjmp_buf* coffeecatch_get_ctx() {