Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: Source/core/dom/Element.cpp

Issue 225163004: Element::focus() should acquire the reference of LocalFrame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use focusout event. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/editing/selection/focus-iframe-removal-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index b69bcd30d4d81d43c05ed5ca03605f1a7d3ff879..7f4bdbdf594e2dc276aa7af299328ff5144ac829 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -2154,7 +2154,8 @@ void Element::focus(bool restorePreviousSelection, FocusType type)
void Element::updateFocusAppearance(bool /*restorePreviousSelection*/)
{
if (isRootEditableElement()) {
- LocalFrame* frame = document().frame();
+ // Taking the ownership since setSelection() may release the last reference to |frame|.
+ RefPtr<LocalFrame> frame(document().frame());
if (!frame)
return;
« no previous file with comments | « LayoutTests/editing/selection/focus-iframe-removal-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698