I think there's a problem when we reparent a Tab with Smart Selection enabled: the UX works but the ContentViewCore is still holding on to the SelectionPopupController that was created for the old activity and (it's holding on to that Context). I discovered this while manually testing a fix for reparenting CS tabs (issue 775813). This all seems error-prone.
I'd like to use this bug to develop a solution that cleanly reparents the SmartSelection instance. Then I can land a fix and merge it into M-63 to complete the Smart Selection work.
The SmartSelectionClient is created with a WebContents that it watches, and when it's destroyed the native SmartSelectionClient is destroyed. However it seems that Tab reparenting may allow the CVC and webContents to live even as they are moved from one activity to another. So I'm thinking that a SelectionClient could have a new destroy() method that detaches it from its WebContents and then calls the destructor. How does that sound?
Comment 1 by boliu@chromium.org
, Nov 2 2017