diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 36a5e7df1818..f7e840f5f28e 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -621,7 +621,7 @@ nsTreeBodyFrame::InvalidateColumn(nsITreeColumn* aCol) if (mUpdateBatchNest) return NS_OK; - nsTreeColumn* col = GetColumnImpl(aCol); + nsRefPtr col = GetColumnImpl(aCol); if (!col) return NS_ERROR_INVALID_ARG; @@ -666,7 +666,7 @@ nsTreeBodyFrame::InvalidateCell(PRInt32 aIndex, nsITreeColumn* aCol) if (aIndex < 0 || aIndex > mPageLength) return NS_OK; - nsTreeColumn* col = GetColumnImpl(aCol); + nsRefPtr col = GetColumnImpl(aCol); if (!col) return NS_ERROR_INVALID_ARG; @@ -709,7 +709,7 @@ nsTreeBodyFrame::InvalidateColumnRange(PRInt32 aStart, PRInt32 aEnd, nsITreeColu if (mUpdateBatchNest) return NS_OK; - nsTreeColumn* col = GetColumnImpl(aCol); + nsRefPtr col = GetColumnImpl(aCol); if (!col) return NS_ERROR_INVALID_ARG; @@ -1630,7 +1630,7 @@ nsTreeBodyFrame::IsCellCropped(PRInt32 aRow, nsITreeColumn* aCol, PRBool *_retva nsCOMPtr rc; GetPresContext()->PresShell()->CreateRenderingContext(this, getter_AddRefs(rc)); - nsTreeColumn* col = GetColumnImpl(aCol); + nsRefPtr col = GetColumnImpl(aCol); if (!col) return NS_ERROR_INVALID_ARG; @@ -3645,7 +3645,7 @@ nsresult nsTreeBodyFrame::EnsureRowIsVisibleInternal(const ScrollParts& aParts, NS_IMETHODIMP nsTreeBodyFrame::EnsureCellIsVisible(PRInt32 aRow, nsITreeColumn* aCol) { - nsTreeColumn* col = GetColumnImpl(aCol); + nsRefPtr col = GetColumnImpl(aCol); if (!col) return NS_ERROR_INVALID_ARG; @@ -3690,7 +3690,7 @@ NS_IMETHODIMP nsTreeBodyFrame::ScrollToColumn(nsITreeColumn* aCol) nsresult nsTreeBodyFrame::ScrollToColumnInternal(const ScrollParts& aParts, nsITreeColumn* aCol) { - nsTreeColumn* col = GetColumnImpl(aCol); + nsRefPtr col = GetColumnImpl(aCol); if (!col) return NS_ERROR_INVALID_ARG; return ScrollHorzInternal(aParts, col->GetX()); diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.h b/layout/xul/base/src/tree/src/nsTreeBodyFrame.h index 57f40ca06eed..002631cd6f94 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.h +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.h @@ -356,14 +356,13 @@ protected: InvalidateRow(aRow + aOrientation); }; - nsTreeColumn* GetColumnImpl(nsITreeColumn* aUnknownCol) { + already_AddRefed GetColumnImpl(nsITreeColumn* aUnknownCol) { if (!aUnknownCol) return nsnull; - nsRefPtr col; - nsresult rv = aUnknownCol->QueryInterface(kTreeColumnImplCID, - getter_AddRefs(col)); - return NS_SUCCEEDED(rv) ? col.get() : nsnull; + nsTreeColumn* col; + aUnknownCol->QueryInterface(kTreeColumnImplCID, (void**)&col); + return col; } // Create a new timer. This method is used to delay various actions like