Repository navigation
Commit 5358e59
committed
iOS: Add null-check for touch rate correction task runner
`FlutterViewController.viewDidLoad` creates a vsync client to correct
the rate at which touch events are delivered on ProMotion displays, and
passes it `self.engine.platformTaskRunner`. That property is nullable
and only set once the engine's shell is created, then cleared again in
`destroyContext`. `FlutterVSyncClient` requires a non-null task runner
and dereferences it. A view controller whose engine is nil would
dereference null and takes the app down with it, at launch. We now bail
out when there's no task runner.
The argument is that losing whatever smoothing effect this has while we
have no running egnine has no effect, and either way it's better than a
null deref.
There's the separate argument detailed in flutter#191199 that this entire
client isn't really doing anything positive and should be deleted. This
simply prevents the null deref until that work can land.
Also worth noting that `platformTaskRunner` is declared `nullable` and
the Swift-generated `initWithTaskRunner:` takes a `_Nonnull` task
runner, so clang spotted this issue when I enabled
`-Wnullable-to-nonnull-conversion`:
```
FlutterViewController.mm:1332:36: warning: implicit conversion from nullable
pointer 'FlutterFMLTaskRunner * _Nullable' to non-nullable pointer type
'FlutterFMLTaskRunner * _Nonnull' [-Wnullable-to-nonnull-conversion]
```
I'll follow up with a patch that enables that warning, but it requires a
few other cleanups first.
Issue: flutter#1900301 parent c842d69 commit 5358e59
2 files changed
Lines changed: 38 additions & 1 deletion
File tree
- engine/src/flutter/shell/platform/darwin/ios/framework/Source
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1324 | 1324 | | |
1325 | 1325 | | |
1326 | 1326 | | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
1327 | 1337 | | |
1328 | 1338 | | |
1329 | 1339 | | |
1330 | 1340 | | |
1331 | 1341 | | |
1332 | | - | |
| 1342 | + | |
1333 | 1343 | | |
1334 | 1344 | | |
1335 | 1345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2887 | 2887 | | |
2888 | 2888 | | |
2889 | 2889 | | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
2890 | 2917 | | |
2891 | 2918 | | |
2892 | 2919 | | |
| |||
0 commit comments