-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[Google3 Bug]: Back button causes crash #168445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@letramygoogle This seems similar to #167489 which was fixed couple of weeks ago. If you could try with latest master version to see if it resolves ? |
Hi I have tried with the latest master version that's rolled into google3 and it seems that the issue is still reproducible. |
Output from fg3 doctor when running fg3 but built from source
|
The flutter tools issue is a red herring - unrelated to the crash being reported. letramygoogle is attempting to create a minimal repro now and will report back with more public info 🙏🙏🙏🙏🙏🙏 |
Pasting the stack trace here
|
Thanks for the logs, I'll keep the issue open and label for team's tracking based on the error report and log. |
Looks like it's probably this setState, based on the stacktrace:
And that gets called when the MaterialState changes, for example when hovering the button or something like that. Maybe that helps in tracking down a repro. |
The roll in the description only has 3 PRs... #167614 I think is the most likely culprit, but we can't know without more information to reproduce it. |
Attached the minimum reprod in cl/759384483 |
I was able to reproduce it only once. I still don't know how. EDIT: Finally able to repro on iOS simulator. tooltip.bug.repro.movSample codeimport 'package:flutter/material.dart';
void main() => runApp(const ReproApp());
class ReproApp extends StatelessWidget {
const ReproApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: InitialPage(title: 'Flutter Demo Home Page'),
);
}
}
class InitialPage extends StatelessWidget {
final String title;
InitialPage({Key? key, required this.title}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title, style: TextStyle(fontFamily: 'ProductSans')),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Welcome to the Initial Page!'),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MyHomePage(title: 'Flutter Demo Home Page')),
);
},
child: Text('Go to Counter Page'),
),
],
),
),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title, style: TextStyle(fontFamily: 'ProductSans')),
),
body: Center(
child: Column( // Use Column to place multiple widgets vertically
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Button tapped $_counter time${_counter == 1 ? '' : 's'}.',
key: Key('CountText'),
),
SizedBox(height: 20), // Add some space
ElevatedButton(
onPressed: () {
// Navigate to the new DetailsPage
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DetailsPage()),
);
},
child: Text('Go to Details Page'),
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
),
);
}
}
class DetailsPage extends StatelessWidget {
const DetailsPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Details Page', style: TextStyle(fontFamily: 'ProductSans')),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'This is the details page!',
style: Theme.of(context).textTheme.headlineSmall,
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('Go Back'),
),
],
),
),
);
}
} |
Confirmed, #167614 causes the bug. cc @rkishan516 who was the PR author. |
Yes @victorsanni, I think #168546 should be able to resolve this issue. Can you please test ? |
I can reproduce this consistently with this code. Navigate to the details page and then press the back button twice to return to the root page. Codeimport 'package:flutter/material.dart';
void main() async {
runApp(_MyApp());
}
class _MyApp extends StatelessWidget {
const _MyApp();
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: InitialPage(title: 'Initial Page'),
);
}
}
class InitialPage extends StatelessWidget {
final String title;
const InitialPage({super.key, required this.title});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title, style: TextStyle(fontFamily: 'ProductSans')),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Welcome to the Initial Page!'),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MyHomePage(title: 'Flutter Demo Home Page')),
);
},
child: Text('Go to Counter Page'),
),
],
),
),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title, style: TextStyle(fontFamily: 'ProductSans')),
leading: BackButton(
onPressed: () {
print('justin pressed back on second page.');
Navigator.maybePop(context);
},
),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
onPressed: () {
// Navigate to the new DetailsPage
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DetailsPage()),
);
},
child: Text('Go to Details Page'),
),
],
),
),
);
}
}
class DetailsPage extends StatelessWidget {
const DetailsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: BackButton(
onPressed: () {
print('justin pressed back on details.');
Navigator.maybePop(context);
},
),
title:
Text('Details Page', style: TextStyle(fontFamily: 'ProductSans')),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'This is the details page!',
style: Theme.of(context).textTheme.headlineSmall,
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('Go Back'),
),
],
),
),
);
}
} Indeed #168546 seems to fix this issue. I guess the tooltip was interfering with the button somehow. I also tried removing the |
Fixes #168545. Fixes #168445. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…tter#169007) This PR introduces two new widgets: - `DisableWidgetInspectorScope`, which hides its children from the widget inspector - `EnableWidgetInspectorScope`, which makes its children available to the widget inspector These widgets are used to inform the `WidgetInspectorService`'s `InspectorSerializationDelegate` when it should be omitting `DiagnosticableNodes` from the response when building the root widget tree for the inspector. This functionality is meant to be used by developer tooling and packages that want to prevent unnecessary implementation details from polluting the inspector and possibly confusing end users. This change also includes some minor updates to the Widget Preview scaffolding template to hide the scaffold's implementation details and only show details for the previews defined by the user. Part of flutter#166423 **Widget Previewer Demo** <img width="1606" alt="image" src="https://github.com/user-attachments/assets/eb23160e-01c5-413f-b1d2-97985ced9ef9" /> [flutter_tool] Remove unused environment flags in JS compiler (flutter#169097) Removes things left over from refactoring in flutter@5a9fa1e Add documentation for experimental branches, update artifacts. (flutter#169109) I still need to get the Firebase short URL, but PTAL. [native assets] Roll dependencies (flutter#169073) Roll deps to the ones released today. Fix the issue with Tooltip (flutter#168546) Fixes flutter#168545. Fixes flutter#168445. - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Roll pub packages (flutter#169181) This PR was generated by `flutter update-packages --force-upgrade`. Remove `isExplicitPackageDependenciesEnabled: true`, it is the default. (flutter#169156) This flag has been enabled by default for quite some time in `master`, and in the current `stable`. This is the first of many PRs to get rid of the flag and the deprecated code it is guarding. Fix dart format for asset.dart Fix an issue about tool_tests_general
EDIT by @matanlurey: This has nothing to do with the Flutter tool, it was a red herring. See #168445 (comment).
Help us understand the severity of this issue
Steps to reproduce
Crash report: b/416159318
It seems that the culprit is this Flutter roll cl/753573741
Expected results
App doesn't crash
Actual results
App crashed
Code sample
Not adding a minimal repro as not sure what caused the crash
Screenshots or Video
Attached in b/416159318
Logs
Attached in b/416159318
Flutter Doctor output
The text was updated successfully, but these errors were encountered: