Index: Source/core/editing/TypingCommand.cpp |
diff --git a/Source/core/editing/TypingCommand.cpp b/Source/core/editing/TypingCommand.cpp |
index 47830a99e7d67baf690af586b3c3494656ccbd2b..f0b7aeab8b8c0e44ff3e95c46abc85ca7e0d8029 100644 |
--- a/Source/core/editing/TypingCommand.cpp |
+++ b/Source/core/editing/TypingCommand.cpp |
@@ -40,6 +40,7 @@ |
#include "core/editing/VisiblePosition.h" |
#include "core/editing/VisibleUnits.h" |
#include "core/editing/htmlediting.h" |
+#include "core/frame/FrameProtector.h" |
#include "core/frame/LocalFrame.h" |
#include "core/html/HTMLBRElement.h" |
#include "core/rendering/RenderObject.h" |
@@ -169,7 +170,8 @@ void TypingCommand::insertText(Document& document, const String& text, Options o |
// FIXME: We shouldn't need to take selectionForInsertion. It should be identical to FrameSelection's current selection. |
void TypingCommand::insertText(Document& document, const String& text, const VisibleSelection& selectionForInsertion, Options options, TextCompositionType compositionType) |
{ |
- RefPtr<LocalFrame> frame = document.frame(); |
+ LocalFrame* frame = document.frame(); |
+ FrameProtector protect(frame); |
ASSERT(frame); |
VisibleSelection currentSelection = frame->selection().selection(); |
@@ -179,7 +181,7 @@ void TypingCommand::insertText(Document& document, const String& text, const Vis |
// Set the starting and ending selection appropriately if we are using a selection |
// that is different from the current selection. In the future, we should change EditCommand |
// to deal with custom selections in a general way that can be used by all of the commands. |
- if (RefPtrWillBeRawPtr<TypingCommand> lastTypingCommand = lastTypingCommandIfStillOpenForTyping(frame.get())) { |
+ if (RefPtrWillBeRawPtr<TypingCommand> lastTypingCommand = lastTypingCommandIfStillOpenForTyping(frame)) { |
if (lastTypingCommand->endingSelection() != selectionForInsertion) { |
lastTypingCommand->setStartingSelection(selectionForInsertion); |
lastTypingCommand->setEndingSelection(selectionForInsertion); |
@@ -193,7 +195,7 @@ void TypingCommand::insertText(Document& document, const String& text, const Vis |
} |
RefPtrWillBeRawPtr<TypingCommand> cmd = TypingCommand::create(document, InsertText, newText, options, compositionType); |
- applyTextInsertionCommand(frame.get(), cmd, selectionForInsertion, currentSelection); |
+ applyTextInsertionCommand(frame, cmd, selectionForInsertion, currentSelection); |
} |
void TypingCommand::insertLineBreak(Document& document, Options options) |