-
Notifications
You must be signed in to change notification settings - Fork 6k
[Windows] Shutdown the engine before destroying the surface #41012
Conversation
yaakovschectman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM save for one nit. Thanks!
cbracken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I can't remember, do we allow headless execution on Windows? If so, we probably want to only shutdown if headless execution isn't permitted. On macOS/iOS we do this by setting an ivar in our engine wrapper. On Linux we have a separate headless renderer.
Kind of. On Windows you can create an engine and run it without attaching a view controller. During that period, Windows is effectively running in headless mode and will ignore attempts to render. However, the Windows engine cannot transition back to headless mode once a view controller has been attached. The view controller owns the engine, destroying the view controller will shutdown the engine. This is something we'll fix as part of the multi-view work :) |
…41012) [Windows] Shutdown the engine before destroying the surface
Currently, closing the window does the following:
FlutterWindowsViewdestroys its surfaceFlutterWindowsViewdestroys theFlutterWindowsEngineit ownsFlutterWindowsEngineshuts down the real engine (1, 2)As a result, the raster thread may attempt to draw to a destroyed surface. This change ensures the engine is shutdown before destroying the view's resources. This ensures the raster thread is stopped before the underlying surface is destroyed.
Addresses flutter/flutter#124463
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.