Index: /trunk/src/VBox/Main/glue/glue-java.xsl
===================================================================
--- /trunk/src/VBox/Main/glue/glue-java.xsl	(revision 40673)
+++ /trunk/src/VBox/Main/glue/glue-java.xsl	(revision 40674)
@@ -4021,4 +4021,5 @@
     public void cleanup()
     {
+        disconnect();
         deinitPerThread();
     }
@@ -4054,4 +4055,15 @@
     public void waitForEvents(long tmo)
     {
+    }
+    
+    protected void finalize() throws Throwable 
+    {
+        try {
+            cleanup();
+        } catch(Exception e) {
+        }
+        finally {
+            super.finalize();
+        }
     }
 }
