diff options
Diffstat (limited to 'editor/libeditor/EditorBase.cpp')
-rw-r--r-- | editor/libeditor/EditorBase.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index f0f3095d6..9bae5dfa0 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -688,13 +688,10 @@ EditorBase::DoTransaction(nsITransaction* aTxn) { if (mPlaceHolderBatch && !mPlaceHolderTxn) { nsCOMPtr<nsIAbsorbingTransaction> placeholderTransaction = - new PlaceholderTransaction(); + new PlaceholderTransaction(*this, mPlaceHolderName, Move(mSelState)); // Save off weak reference to placeholder transaction mPlaceHolderTxn = do_GetWeakReference(placeholderTransaction); - placeholderTransaction->Init(mPlaceHolderName, mSelState, this); - // placeholder txn took ownership of this pointer - mSelState = nullptr; // QI to an nsITransaction since that's what DoTransaction() expects nsCOMPtr<nsITransaction> transaction = @@ -944,7 +941,7 @@ EditorBase::BeginPlaceHolderTransaction(nsIAtom* aName) mPlaceHolderName = aName; RefPtr<Selection> selection = GetSelection(); if (selection) { - mSelState = new SelectionState(); + mSelState = MakeUnique<SelectionState>(); mSelState->SaveSelection(selection); // Composition transaction can modify multiple nodes and it merges text // node for ime into single text node. @@ -1008,7 +1005,6 @@ EditorBase::EndPlaceHolderTransaction() if (mPlaceHolderName == nsGkAtoms::IMETxnName) { mRangeUpdater.DropSelectionState(*mSelState); } - delete mSelState; mSelState = nullptr; } // We might have never made a placeholder if no action took place. |