Skip to content

Commit

Permalink
Do not drop the DartExecutor's message handler when a FlutterNativeVi…
Browse files Browse the repository at this point in the history
…ew is detached from the FlutterView (flutter#8254)

An activity can use ViewFactory.retainNativeFlutterView to reuse a
FlutterNativeView across multiple instances of the activity.  In this
scenario, the FlutterNativeView should continue to handle incoming messages
sent from Dart.
  • Loading branch information
jason-simmons authored Mar 22, 2019
1 parent adc6685 commit 68bd4f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ public FlutterNativeView(@NonNull Context context, boolean isBackgroundView) {
assertAttached();
}

public void detach() {
public void detachFromFlutterView() {
mPluginRegistry.detach();
dartExecutor.onDetachedFromJNI();
mFlutterView = null;
}

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/io/flutter/view/FlutterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public FlutterNativeView detach() {
if (!isAttached())
return null;
getHolder().removeCallback(mSurfaceCallback);
mNativeView.detach();
mNativeView.detachFromFlutterView();

FlutterNativeView view = mNativeView;
mNativeView = null;
Expand Down

0 comments on commit 68bd4f2

Please sign in to comment.