Bug 637621, allow selection collapse more often, r+a=jst
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Tue, 29 Mar 2011 19:36:58 +0300
changeset 27381 74fd63b96277529a73ce0f138b2bfa2efb9c371a
parent 27378 51ac17f4dd02956f7915c209d576be0845d97fe7
child 27382 fbb2dfda1784cbce2f2e0a078286f9869e94af5c
push id2703
push useropettay@mozilla.com
push dateTue, 29 Mar 2011 16:53:46 +0000
bugs637621
milestone1.9.1.19pre
Bug 637621, allow selection collapse more often, r+a=jst
layout/generic/nsSelection.cpp
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -5514,16 +5514,19 @@ nsTypedSelection::RemoveRange(nsIDOMRang
  */
 NS_IMETHODIMP
 nsTypedSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset)
 {
   if (!aParentNode)
     return NS_ERROR_INVALID_ARG;
   if (!mFrameSelection)
     return NS_ERROR_NOT_INITIALIZED; // Can't do selection
+
+  nsCOMPtr<nsINode> kungfuDeathGrip = aParentNode;
+
   mFrameSelection->InvalidateDesiredX();
   if (!IsValidSelectionPoint(mFrameSelection, aParentNode))
     return NS_ERROR_FAILURE;
   nsresult result;
   // Delete all of the current ranges
   nsCOMPtr<nsPresContext>  presContext;
   GetPresContext(getter_AddRefs(presContext));
   Clear(presContext);