This matters because if we don't call WebView.onDestroy(), the WebView leaks its WebMessageListener instances. Capacitor's WebMessageListener holds a references to the CapacitorWebView, which holds a reference to the Bridge, which holds a reference to the BridgeFragment.
Expected Behavior
After BridgeFragment.onDestroy(), Capacitor cleans up all resources
Project Reproduction
Please let me know if you require a repro for this.
Additional Information
One can work around this by extending BridgeFragment.onDestroy() and calling bridge.getWebView().destroy() manually.
Capacitor Version
[warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted. π Capacitor Doctor π
Latest Dependencies:
@capacitor/cli: 6.1.1 @capacitor/core: 6.1.1 @capacitor/android: 6.1.1 @capacitor/ios: 6.1.1
Installed Dependencies:
@capacitor/cli: 6.1.1 @capacitor/ios: 6.1.1 @capacitor/android: 6.1.1 @capacitor/core: 6.1.1
[success] iOS looking great! π [success] Android looking great! π
Other API Details
Platforms Affected
Current Behavior
BridgeFragment.onDestroy()
callsBridge.onDestroy()
, butBridge.onDestroy()
does not callWebView.destroy()
.This matters because if we don't call
WebView.onDestroy()
, theWebView
leaks itsWebMessageListener
instances. Capacitor'sWebMessageListener
holds a references to theCapacitorWebView
, which holds a reference to theBridge
, which holds a reference to theBridgeFragment
.Expected Behavior
After
BridgeFragment.onDestroy()
, Capacitor cleans up all resourcesProject Reproduction
Please let me know if you require a repro for this.
Additional Information
One can work around this by extending
BridgeFragment.onDestroy()
and callingbridge.getWebView().destroy()
manually.Thank you for this project!