* src/threads/thread.cpp: Break a reference cycle.
[cacao.git] / src / threads / thread.cpp
index ab0e05e2fe7315bf9dfd2578aafe702199075130..b111ca90f70bdaf74e9f073f93bf49e970ed65e0 100644 (file)
@@ -369,6 +369,10 @@ static threadobject *thread_new(int32_t flags)
 
 void thread_free(threadobject *t)
 {
+       java_handle_t *h = LLNI_WRAP(t->object);
+       java_lang_Thread jlt(h);
+       ThreadRuntime::clear_heap_reference(jlt);
+
        /* Set the reference to the Java object to NULL. */
 
        t->object = 0;