summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-30 08:46:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-30 08:46:41 +0000
commit04ca48fc38f9d006e2711287f9576a606d0d269a (patch)
treed2a92d8e9e63901f8c40620b287c3cb6e043d20d /eval.c
parent520f0fec9519647e8ae1dfc15756b537fe580d6e (diff)
eval.c: determine exit status and signal before finalization
* eval.c (ruby_cleanup): determine exit status and signal to terminate before finalization, to get rid of access destroyed T_DATA execption object. [ruby-core:58643] [Bug #9167] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index 15b0db2ce8..f3275ada0b 100644
--- a/eval.c
+++ b/eval.c
@@ -192,12 +192,6 @@ ruby_cleanup(volatile int ex)
}
th->errinfo = errs[1];
ex = error_handle(ex);
- ruby_finalize_1();
-
- /* unlock again if finalizer took mutexes. */
- rb_threadptr_unlock_all_locking_mutexes(GET_THREAD());
- POP_TAG();
- rb_thread_stop_timer_thread(1);
#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
switch (ex) {
@@ -232,6 +226,13 @@ ruby_cleanup(volatile int ex)
ex = EXIT_FAILURE;
}
}
+
+ ruby_finalize_1();
+
+ /* unlock again if finalizer took mutexes. */
+ rb_threadptr_unlock_all_locking_mutexes(GET_THREAD());
+ POP_TAG();
+ rb_thread_stop_timer_thread(1);
ruby_vm_destruct(GET_VM());
if (state) ruby_default_signal(state);