Bug 1486596 - Implement finalizer for GeckoSession.Window r=jchen
authorJames Willcox <snorp@snorp.net>
Wed, 29 Aug 2018 17:23:46 -0500
changeset 487737 4a8062e9732e9ccd19578e93d28fccbbc5453289
parent 487736 e7ddac13c48fd31edaaaf69288c6e8151bd91738
child 487738 c0cef26afa24e0f1c3f1ecd29fccd7f7472348c5
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersjchen
bugs1486596
milestone64.0a1
Bug 1486596 - Implement finalizer for GeckoSession.Window r=jchen
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
@@ -813,16 +813,22 @@ public class GeckoSession extends LayerS
             }
 
             if (mNativeQueue.checkAndSetState(State.INITIAL, State.READY) &&
                     queue == null) {
                 Log.i(LOGTAG, "zerdatime " + SystemClock.elapsedRealtime() +
                       " - chrome startup finished");
             }
         }
+
+        @Override
+        protected void finalize() throws Throwable {
+            close();
+            disposeNative();
+        }
     }
 
     private class Listener implements BundleEventListener {
         /* package */ void registerListeners() {
             getEventDispatcher().registerUiThreadListener(this,
                 "GeckoView:PinOnScreen",
                 "GeckoView:Prompt",
                 null);