-
Notifications
You must be signed in to change notification settings - Fork 6k
Unregister the FlutterWindowsView on its destruction #39824
Unregister the FlutterWindowsView on its destruction #39824
Conversation
| } | ||
|
|
||
| FlutterWindowsView::~FlutterWindowsView() { | ||
| DestroyRenderSurface(); |
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.
This is fine but I think it'd be preferable if the view was deregistered from the engine before its state is torn down. This way the engine does not point to a "bad" view.
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.
What are you considering when the state is torn down? At the start of the destructor being called?
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.
I meant that I would deregister the view before destroying the render surface. So yup, deregistering the view at the start of the destructor would work
3f2f0e0 to
000e03a
Compare
loic-sharma
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.
Nice work!
scutlight
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!
This reverts commit d2d00be.
#40607) Revert "Unregister the FlutterWindowsView on its destruction"
…#39824)" (flutter#40607) Revert "Unregister the FlutterWindowsView on its destruction"
FlutterWindowsViewowns both theFlutterWindowsEngineandWindowBindingHandleras unique pointers, so each is released upon its destruction. However, in the brief time between the release of the handler and the engine, the engine may attempt to call a method that expects the handler to exist.Solve this by unsetting the engine's view from
FlutterWindowsView::~FlutterWindowsView, which should complete before destructing its members. Include a unit test to verify that the view is unset by the time the handler is released.flutter/flutter#121189
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.