Commit 411db2d5 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Tabs occasionally tried to setState after dispose (#5784)

Fixes https://github.com/flutter/flutter/issues/5776
parent e7601e3f
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
To run these benchmarks on a device: To run these benchmarks on a device:
``` ```
flutter run --release -t lib/gestures/velocity_tracker_data.dart flutter run --release lib/gestures/velocity_tracker_data.dart
flutter run --release -t lib/stocks/animation_bench.dart flutter run --release lib/stocks/animation_bench.dart
flutter run --release -t lib/stocks/build_bench.dart flutter run --release lib/stocks/build_bench.dart
flutter run --release -t lib/stocks/layout_bench.dart flutter run --release lib/stocks/layout_bench.dart
``` ```
The results should be in the device logs. The results should be in the device logs.
...@@ -11,7 +11,6 @@ const Duration kBenchmarkTime = const Duration(seconds: 15); ...@@ -11,7 +11,6 @@ const Duration kBenchmarkTime = const Duration(seconds: 15);
Future<Null> main() async { Future<Null> main() async {
assert(false); // don't run this in checked mode! Use --release.
stock_data.StockDataFetcher.actuallyFetchData = false; stock_data.StockDataFetcher.actuallyFetchData = false;
final Stopwatch watch = new Stopwatch(); final Stopwatch watch = new Stopwatch();
......
...@@ -977,10 +977,12 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect ...@@ -977,10 +977,12 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect
_indicatorRect = _selection != null ? _tabIndicatorRect(_selection.index) : Rect.zero; _indicatorRect = _selection != null ? _tabIndicatorRect(_selection.index) : Rect.zero;
_updateScrollBehavior(); _updateScrollBehavior();
SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) { SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) {
setState(() { if (mounted) {
// the changes were made at layout time setState(() {
// TODO(ianh): remove this setState: https://github.com/flutter/flutter/issues/5749 // the changes were made at layout time
}); // TODO(ianh): remove this setState: https://github.com/flutter/flutter/issues/5749
});
}
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment