Bug 1388917 - Fix moving of SelectionState in PlaceholderTransaction's constructor; r=masayuki

This commit is contained in:
Ehsan Akhgari 2017-08-09 19:17:22 -04:00
parent 38bfadf1a9
commit 3ab3b25fad
2 changed files with 5 additions and 1 deletions

View File

@ -677,6 +677,7 @@ EditorBase::DoTransaction(Selection* aSelection, nsITransaction* aTxn)
if (mPlaceholderBatch && !mPlaceholderTransaction) {
mPlaceholderTransaction =
new PlaceholderTransaction(*this, mPlaceholderName, Move(mSelState));
MOZ_ASSERT(mSelState.isNothing());
// We will recurse, but will not hit this case in the nested call
DoTransaction(mPlaceholderTransaction);

View File

@ -24,9 +24,12 @@ PlaceholderTransaction::PlaceholderTransaction(
, mForwarding(nullptr)
, mCompositionTransaction(nullptr)
, mCommitted(false)
, mStartSel(Move(*aSelState))
, mEditorBase(&aEditorBase)
{
// Make sure to move aSelState into a local variable to null out the original
// Maybe<SelectionState> variable.
Maybe<SelectionState> selState(Move(aSelState));
mStartSel = *selState;
mName = aName;
}