Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Remove the method channel's reference to webview/maps on dispose. (#1221
Browse files Browse the repository at this point in the history
)

The reference from the method channel to the webview/maps instance was never cleared on Android, which leaked memory as even after disposing the platform view the view was not released.

[flutter/flutter#24145](flutter/flutter#24145)
  • Loading branch information
amirh authored Feb 14, 2019
1 parent 9bf429d commit 0f14f68
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.0+3

* Fixed a memory leak on Android - the map was not properly disposed.

## 0.2.0+2

* Log a more detailed warning at build time about the previous AndroidX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ public void dispose() {
return;
}
disposed = true;
methodChannel.setMethodCallHandler(null);
mapView.onDestroy();
registrar.activity().getApplication().unregisterActivityLifecycleCallbacks(this);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/google_maps_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
version: 0.2.0+2
version: 0.2.0+3

dependencies:
flutter:
Expand Down
4 changes: 4 additions & 0 deletions packages/webview_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.3+1

* Fixed a memory leak on Android - the WebView was not properly disposed.

## 0.3.3

* Add clearCache method to WebView controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,7 @@ private void registerJavaScriptChannelNames(List<String> channelNames) {
}

@Override
public void dispose() {}
public void dispose() {
methodChannel.setMethodCallHandler(null);
}
}
2 changes: 1 addition & 1 deletion packages/webview_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: webview_flutter
description: A Flutter plugin that provides a WebView widget on Android and iOS.
version: 0.3.3
version: 0.3.3+1
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/webview_flutter

Expand Down

0 comments on commit 0f14f68

Please sign in to comment.