Repository navigation
Commit 3faa26f
authored
[stable] [flutter_tools] Fix PathNotFoundException during native assets cleanup (#191279)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
#190234
### Impact Description:
During native assets cleanup in `_copyNativeCodeAssetsForOS`, `flutter_tools` iterated over files and called `delete` on each entity. If a file (such as a temporary or OS metadata file) was removed concurrently between listing and deletion, the tool crashed with an unhandled `PathNotFoundException`. This was identified as a top-10 crash signature in Flutter stable release 3.44.8.
### Changelog Description:
[flutter/190234] Avoid crashing with PathNotFoundException when cleaning up native assets if files are removed concurrently.
### Workaround:
Rerun `flutter clean` or rebuild the application.
### Risk:
### Test Coverage:
### Validation Steps:
1. Build a project using native assets across multiple targets or runs.
2. Verify that cleaning native asset build directories handles missing or transient files gracefully via `deleteIfExists` without throwing `PathNotFoundException`.
3. Run `packages/flutter_tools` unit tests.1 parent ef055f1 commit 3faa26f
2 files changed
Lines changed: 47 additions & 2 deletions
File tree
- packages/flutter_tools
- lib/src/isolated/native_assets
- test/general.shard/isolated
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
830 | 831 | | |
831 | 832 | | |
832 | 833 | | |
833 | | - | |
834 | | - | |
| 834 | + | |
| 835 | + | |
835 | 836 | | |
836 | 837 | | |
837 | 838 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
396 | 440 | | |
397 | 441 | | |
398 | 442 | | |
| |||
0 commit comments