summaryrefslogtreecommitdiff
path: root/ext/java/java.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/java/java.c')
-rw-r--r--ext/java/java.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/java/java.c b/ext/java/java.c
index 238b9930b2..d14fc4d1c5 100644
--- a/ext/java/java.c
+++ b/ext/java/java.c
@@ -101,12 +101,15 @@ PHP_INI_END()
*/
void jvm_destroy() {
if (php_reflect) (*jenv)->DeleteGlobalRef(jenv, php_reflect);
- if (jvm) (*jvm)->DestroyJavaVM(jvm);
+ if (jvm) {
+ (*jvm)->DetachCurrentThread(jvm);
+ (*jvm)->DestroyJavaVM(jvm);
+ jvm = 0;
+ }
#if !(WIN32||WINNT)
if (javadl) dlclose(javadl);
#endif
php_reflect = 0;
- jvm = 0;
jenv = 0;
}