-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Closed
flutter/engine
#31390Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsc: crashStack traces logged to the consoleStack traces logged to the consolec: fatal crashCrashes that terminate the processCrashes that terminate the processc: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 2.10Found to occur in 2.10Found to occur in 2.10found in release: 2.11Found to occur in 2.11Found to occur in 2.11has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Seems like whenever there is another PlatformView active (tested with WebView plugin) and that view is disposed app is crashing.
Steps to reproduce:
- Add into list
webviewandvideoplayerwidget - Play video
- Scroll so that
webviewis not visible anymore - App is crashed
Tested on physical devices: Samsung S9 (Android 11), Pixel 3 (Android 12)
On iOS devices crash is not happening.
Screen recording:
Screen_Recording_20220209-230842_One.UI.Home.mp4
Min code to reproduce
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() => runApp(const VideoApp());
class VideoApp extends StatefulWidget {
const VideoApp({final Key? key}) : super(key: key);
@override
_VideoAppState createState() => _VideoAppState();
}
class _VideoAppState extends State<VideoApp> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4',
)
..initialize()
..setLooping(true)
..play().then((_) {
// Ensure the first frame is shown after the video is initialized,
// even before the play button has been pressed.
setState(() {});
});
}
@override
Widget build(final BuildContext context) {
return MaterialApp(
title: 'Video Demo',
home: Scaffold(
body: ListView(
children: [
..._generateChildren(5),
const SizedBox(
height: 200,
child: WebView(
initialUrl:
'https://www.youtube.com/watch?v=oYnpQ3Mjg_g&ab_channel=TeslaDaily',
javascriptMode: JavascriptMode.unrestricted,
),
),
Center(
child: _controller.value.isInitialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)
: const SizedBox(),
),
..._generateChildren(10),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
_controller.value.isPlaying
? _controller.pause()
: _controller.play();
});
},
child: Icon(
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
),
),
),
);
}
List<Widget> _generateChildren(final int number) {
final List<Widget> children = [];
for (var i = 0; i < number; i++) {
children.add(
Container(
height: 80,
color: Color((math.Random().nextDouble() * 0xFFFFFF).toInt())
.withOpacity(1),
),
);
}
return children;
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
}Crash log
E/n.staging.debu(28654): [SurfaceTexture-0-28654-0] attachToContext: SurfaceTexture is already attached to a context
E/flutter (28654): [ERROR:flutter/fml/platform/android/jni_util.cc(211)] java.lang.RuntimeException: Error during attachToGLContext (see logcat for details)
E/flutter (28654): at android.graphics.SurfaceTexture.attachToGLContext(SurfaceTexture.java:295)
E/flutter (28654): at io.flutter.embedding.engine.renderer.SurfaceTextureWrapper.attachToGLContext(SurfaceTextureWrapper.java:57)
E/flutter (28654): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (28654): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (28654): at android.os.Looper.loop(Looper.java:206)
E/flutter (28654): at android.app.ActivityThread.main(ActivityThread.java:8633)
E/flutter (28654): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (28654): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/flutter (28654): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Flutter doctor
[✓] Flutter (Channel unknown, 2.10.0-0.3.pre, on Mac OS X 10.15.7 19H1615 darwin-x64, locale en-GB)
• Flutter version 2.10.0-0.3.pre at /Users/ndelic/development/flutter
• Upstream repository unknown
• Framework revision fdd0af78bb (2 weeks ago), 2022-01-25 22:01:33 -0600
• Engine revision 5ac30ef0c7
• Dart version 2.16.0 (build 2.16.0-134.5.beta)
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/ndelic/Library/Android/sdk
• Platform android-31, build-tools 32.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
! Flutter recommends a minimum Xcode version of 13.
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[!] Android Studio
• Android Studio at /Users/ndelic/Downloads/Android Studio Preview.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] Connected device (4 available)
• SM G973F (mobile) • R38MA099L6V • android-arm64 • Android 11 (API 30)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.7 19H1615 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
Please let me know if you need more details. This was not happening while running flutter 2.8.x (didn't test with beta 2.9.x)
mj-hd, lcdsmao, akilanfidelis, fidelisakilan, d3xt3r2909 and 6 more
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsc: crashStack traces logged to the consoleStack traces logged to the consolec: fatal crashCrashes that terminate the processCrashes that terminate the processc: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 2.10Found to occur in 2.10Found to occur in 2.10found in release: 2.11Found to occur in 2.11Found to occur in 2.11has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version