Tabs occasionally tried to setState after dispose (#5784)

Fixes https://github.com/flutter/flutter/issues/5776
This commit is contained in:
Ian Hickson 2016-09-09 14:25:34 -07:00 committed by GitHub
parent e7601e3fa5
commit 411db2d587
3 changed files with 10 additions and 9 deletions

View File

@ -3,10 +3,10 @@
To run these benchmarks on a device:
```
flutter run --release -t lib/gestures/velocity_tracker_data.dart
flutter run --release -t lib/stocks/animation_bench.dart
flutter run --release -t lib/stocks/build_bench.dart
flutter run --release -t lib/stocks/layout_bench.dart
flutter run --release lib/gestures/velocity_tracker_data.dart
flutter run --release lib/stocks/animation_bench.dart
flutter run --release lib/stocks/build_bench.dart
flutter run --release lib/stocks/layout_bench.dart
```
The results should be in the device logs.

View File

@ -11,7 +11,6 @@ const Duration kBenchmarkTime = const Duration(seconds: 15);
Future<Null> main() async {
assert(false); // don't run this in checked mode! Use --release.
stock_data.StockDataFetcher.actuallyFetchData = false;
final Stopwatch watch = new Stopwatch();

View File

@ -977,10 +977,12 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect
_indicatorRect = _selection != null ? _tabIndicatorRect(_selection.index) : Rect.zero;
_updateScrollBehavior();
SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) {
setState(() {
// the changes were made at layout time
// TODO(ianh): remove this setState: https://github.com/flutter/flutter/issues/5749
});
if (mounted) {
setState(() {
// the changes were made at layout time
// TODO(ianh): remove this setState: https://github.com/flutter/flutter/issues/5749
});
}
});
}