mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Log instead of asserting when sending a reply message to a defunct engine (#4084)
Fixes https://github.com/flutter/flutter/issues/12037
This commit is contained in:
parent
2abd7c87e7
commit
a44146f13b
@ -669,7 +669,7 @@ public class FlutterView extends SurfaceView
|
||||
}
|
||||
|
||||
// Called by native to send us a platform message.
|
||||
private void handlePlatformMessage(String channel, byte[] message, final int replyId) {
|
||||
private void handlePlatformMessage(final String channel, byte[] message, final int replyId) {
|
||||
assertAttached();
|
||||
BinaryMessageHandler handler = mMessageHandlers.get(channel);
|
||||
if (handler != null) {
|
||||
@ -680,7 +680,10 @@ public class FlutterView extends SurfaceView
|
||||
private final AtomicBoolean done = new AtomicBoolean(false);
|
||||
@Override
|
||||
public void reply(ByteBuffer reply) {
|
||||
assertAttached();
|
||||
if (!isAttached()) {
|
||||
Log.d(TAG, "handlePlatformMessage replying to a detached view, channel=" + channel);
|
||||
return;
|
||||
}
|
||||
if (done.getAndSet(true)) {
|
||||
throw new IllegalStateException("Reply already submitted");
|
||||
}
|
||||
@ -864,7 +867,7 @@ public class FlutterView extends SurfaceView
|
||||
@Override
|
||||
public void send(String channel, ByteBuffer message, BinaryReply callback) {
|
||||
if (!isAttached()) {
|
||||
Log.d("flutter", "FlutterView.send called on a detached view, channel=" + channel);
|
||||
Log.d(TAG, "FlutterView.send called on a detached view, channel=" + channel);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user