Hot Restart should dispose all previous Platform Views (macOS)#163439
Hot Restart should dispose all previous Platform Views (macOS)#163439auto-submit[bot] merged 2 commits intoflutter:masterfrom
Conversation
| _platformViewsToDispose.clear(); | ||
| } | ||
|
|
||
| - (void)reset { |
There was a problem hiding this comment.
I think this should be sufficient but adding @knopp to verify.
I'm happy to do it either way, but the way it is now is intended to match what was happening with the original bug report. I.e., a platform view was created, a Hot Restart was done, and then another platform view with the same id gets created. The test is basically saying that without calling "reset()", you get the exception as described in the original bug report, and then with the "reset()", the problem is resolved. |
In theory somebody can break the reset and change view creation to overwrite existing view (or just fail silently), the test will still pass but the behavior will be wrong. I don't feel too strongly about this either though. |
I'll make the change. It makes more sense as a unit test to consider specifically the contract promised by the code under test, rather than trying to play out a scenario from some remote bug report. |
|
I've updated the test. |
When using Platform Views on macOS, performing a Hot Restart throws an exception with message "trying to create an already created view". This is because the old Platform Views are not cleaned up. So, here we dispose of the old Platform Views as part of the Hot Restart process.
Fixes issue: #110381
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.