瀏覽代碼

OGLESContext#deinitInThread(): releasing the weak references of the Application#context

pavl_g 7 月之前
父節點
當前提交
6735cb71a9
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java

+ 10 - 1
jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java

@@ -247,10 +247,19 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex
             }
 
             listener.destroy();
-
+            // releases the view holder from the Android Input Resources
+            // releasing the view enables the context instance to be
+            // reclaimed by the GC.
+            // if not released; it leads to a weak reference leak
+            // disabling the destruction of the Context View Holder.
+            androidInput.setView(null);
+
+            // nullifying the references
+            // signals their memory to be reclaimed
             listener = null;
             renderer = null;
             timer = null;
+            androidInput = null;
 
             // do android specific cleaning here
             logger.fine("Display destroyed.");