mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Return an already-addrefed nsTreeColumn instead of making assumptions about
object lifetimes. Bug 309429 followup, patch by Nickolay Ponomarev <asqueella@gmail.com>, r+sr=neil
This commit is contained in:
parent
88a4bed601
commit
f31edc79b8
@ -621,7 +621,7 @@ nsTreeBodyFrame::InvalidateColumn(nsITreeColumn* aCol)
|
||||
if (mUpdateBatchNest)
|
||||
return NS_OK;
|
||||
|
||||
nsTreeColumn* col = GetColumnImpl(aCol);
|
||||
nsRefPtr<nsTreeColumn> 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<nsTreeColumn> 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<nsTreeColumn> col = GetColumnImpl(aCol);
|
||||
if (!col)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
@ -1630,7 +1630,7 @@ nsTreeBodyFrame::IsCellCropped(PRInt32 aRow, nsITreeColumn* aCol, PRBool *_retva
|
||||
nsCOMPtr<nsIRenderingContext> rc;
|
||||
GetPresContext()->PresShell()->CreateRenderingContext(this, getter_AddRefs(rc));
|
||||
|
||||
nsTreeColumn* col = GetColumnImpl(aCol);
|
||||
nsRefPtr<nsTreeColumn> 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<nsTreeColumn> 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<nsTreeColumn> col = GetColumnImpl(aCol);
|
||||
if (!col)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
return ScrollHorzInternal(aParts, col->GetX());
|
||||
|
@ -356,14 +356,13 @@ protected:
|
||||
InvalidateRow(aRow + aOrientation);
|
||||
};
|
||||
|
||||
nsTreeColumn* GetColumnImpl(nsITreeColumn* aUnknownCol) {
|
||||
already_AddRefed<nsTreeColumn> GetColumnImpl(nsITreeColumn* aUnknownCol) {
|
||||
if (!aUnknownCol)
|
||||
return nsnull;
|
||||
|
||||
nsRefPtr<nsTreeColumn> 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
|
||||
|
Loading…
Reference in New Issue
Block a user