diff options
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index fbfee499e40..d77c7cf733e 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -96,12 +96,6 @@ cleanup_task(cleanup_args *args) { bool threw_exception = args->threw_exception; rust_task *task = a->task; - cc::do_cc(task); - annihilate_boxes(task); - cc::do_final_cc(task); - - task->die(); - { scoped_lock with(task->kill_lock); if (task->killed && !threw_exception) { @@ -110,6 +104,20 @@ cleanup_task(cleanup_args *args) { } } + // FIXME: For performance we should do the annihilator instead + // of the cycle collector even under normal termination, but + // since that would hide memory management errors (like not derefing + // boxes), it needs to be disableable in debug builds. + if (threw_exception) { + // FIXME: When the annihilator is more powerful and successfully + // runs resource destructors, etc. we can get rid of this cc + cc::do_cc(task); + annihilate_boxes(task); + } + cc::do_final_cc(task); + + task->die(); + task->notify(!threw_exception); if (threw_exception) { |
