-
Notifications
You must be signed in to change notification settings - Fork 6k
Remove FlutterUndoManagerPlugin handlers from undo manager on dealloc #53553
Conversation
| XCTAssertNil(weakUndoManagerPlugin); | ||
| // Regression test for https://github.com/flutter/flutter/issues/150408. | ||
| // Undo manager undo and redo stack should be empty after the plugin deallocs. | ||
| XCTAssertFalse(undoManager.canUndo); |
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 assert fails on main without this change (though I couldn't get it to actually crash):
FlutterUndoManagerPluginTest.mm:198: error: -[FlutterUndoManagerPluginTest testDeallocRemovesAllUndoManagerActions] : ((undoManager.canUndo) is false) failed
hellohuanlin
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.
tricky one!
…150829) flutter/engine@25af762...da62c62 2024-06-26 [email protected] Roll Fuchsia Linux SDK from WUN7NQK04NjF9fRmf... to n2dgSmMCaCO7ujvmr... (flutter/engine#53575) 2024-06-25 [email protected] Remove FlutterUndoManagerPlugin handlers from undo manager on dealloc (flutter/engine#53553) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from WUN7NQK04NjF to n2dgSmMCaCO7 If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
|
@jmagman I'm a bit confused. According to the flutter/flutter#150408 description, if we set |
I don't understand your question, does flutter/flutter#150408 (comment) answer it? |
When
FlutterUndoManagerPlugindeallocated, it is supposed to deregister itself from theNSUndoManagerstack.However, during dealloc
_undoManagerDelegate.undoManageris nil (_undoManagerDelegate= the engine, andundoManagerwas its view controller'sundoManager, which was already gone).Since
_undoManagerDelegate.undoManageris nil, it doesn't actually call-[NSUndoManager removeAllActionsWithTarget]. In the add-to-app scenario, after the view controller pops back to the native view, and "undo" is invoked, the undo action for theFlutterUndoManagerPluginis handled, but it already dealloced so crash.Fixes flutter/flutter#150408
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.