Index: WebCore/dom/Element.cpp |
=================================================================== |
--- WebCore/dom/Element.cpp (revision 52676) |
+++ WebCore/dom/Element.cpp (working copy) |
@@ -1308,8 +1308,12 @@ |
return; |
} |
- if (Page* page = doc->page()) |
+ RefPtr<Node> protect; |
+ if (Page* page = doc->page()) { |
+ // Focus and change event handlers can cause us to lose our last ref. |
+ protect = this; |
page->focusController()->setFocusedNode(this, doc->frame()); |
+ } |
// Setting the focused node above might have invalidated the layout due to scripts. |
doc->updateLayoutIgnorePendingStylesheets(); |