Added ref counting

This commit is contained in:
rods%netscape.com 1998-08-03 22:19:40 +00:00
parent 7fca0c763b
commit c09f6b9e1b
2 changed files with 25 additions and 2 deletions

View File

@ -25,19 +25,42 @@ nsSelectionPoint::nsSelectionPoint(nsIContent * aContent,
fOffset = aOffset;
fIsAnchor = aIsAnchor;
fEntireContent = PR_FALSE;
if (fContent != nsnull)
NS_ADDREF(fContent);
}
nsSelectionPoint::~nsSelectionPoint()
{
NS_IF_RELEASE(fContent);
}
nsIContent * nsSelectionPoint::GetContent()
{
if (fContent != nsnull)
NS_ADDREF(fContent);
return fContent;
}
void nsSelectionPoint::SetContent(nsIContent * aValue)
{
NS_IF_RELEASE(fContent);
fContent = aValue;
if (fContent != nsnull)
NS_ADDREF(fContent);
}
void nsSelectionPoint::SetPoint(nsIContent * aContent,
PRInt32 aOffset,
PRBool aIsAnchor)
{
NS_IF_RELEASE(fContent);
fContent = aContent;
fOffset = aOffset;
fIsAnchor = aIsAnchor;
if (fContent != nsnull)
NS_ADDREF(fContent);
}
/**

View File

@ -35,14 +35,14 @@ class nsSelectionPoint {
virtual ~nsSelectionPoint();
nsIContent * GetContent() { return fContent; }
nsIContent * GetContent();
PRInt32 GetOffset() { return fOffset; }
PRBool IsAnchor() { return fIsAnchor;}
PRBool IsEntireContentSelected() { return fEntireContent; }
void setEntireContentSelected(PRBool aState) { fEntireContent = aState; }
void SetContent(nsIContent * aValue) { fContent = aValue; }
void SetContent(nsIContent * aValue);
void SetOffset(PRInt32 aValue) { fOffset = aValue; }
void SetAnchor(PRBool aValue) { fIsAnchor = aValue; }