Bug 637621, allow selection collapse more often, r+a=jst
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 02 Mar 2011 16:55:12 +0200
changeset 63262 ab7fd603bb9d8aa21777468c8e51f3e2363ab2f7
parent 63261 3a4967bd43e8e777aeef9a4acfd67d7814f07c37
child 63263 f4449a441aea3e465d6ea72eea12ee00bf3d5f8e
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
bugs637621
milestone2.0b13pre
Bug 637621, allow selection collapse more often, r+a=jst
layout/generic/nsSelection.cpp
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -4928,16 +4928,19 @@ nsTypedSelection::Collapse(nsIDOMNode* a
 
 nsresult
 nsTypedSelection::Collapse(nsINode* 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
   nsRefPtr<nsPresContext>  presContext;
   GetPresContext(getter_AddRefs(presContext));
   Clear(presContext);