mirror of
https://github.com/flutter/flutter.git
synced 2026-02-13 14:21:39 +08:00
It's possible that the preview detector is in the middle of processing sources after a source file was changed while the widget previewer is shutting down if we're not holding the mutex. This can result in the analysis context being disposed of when we don't expect it, causing requests to the analyzer to return errors. This change guards against this scenario by ensuring that all calls to `findPreviewFunctions` are guarded by the mutex. This change also removes assumptions related to the return type from analyzer APIs to account for the possibility that an error response was returned. Fixes https://github.com/flutter/flutter/issues/178472