From 4cb998cedd97bfaee6a941d06fd590ab76db4121 Mon Sep 17 00:00:00 2001 From: "leon.sha%sun.com" Date: Mon, 22 May 2006 03:21:57 +0000 Subject: [PATCH] Bug 337854 crash [@ nsTreeContentView::GetCell]. Patch by alfred.peng@sun.com. neil: review+ roc: superreview+ --- content/xul/templates/src/nsXULTreeBuilder.cpp | 9 ++++----- layout/xul/base/src/tree/src/nsTreeContentView.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/content/xul/templates/src/nsXULTreeBuilder.cpp b/content/xul/templates/src/nsXULTreeBuilder.cpp index 6300572ab91b..35db7fa5c042 100644 --- a/content/xul/templates/src/nsXULTreeBuilder.cpp +++ b/content/xul/templates/src/nsXULTreeBuilder.cpp @@ -1463,9 +1463,9 @@ nsXULTreeBuilder::GetTemplateActionCellFor(PRInt32 aRow, nsCOMPtr row; GetTemplateActionRowFor(aRow, getter_AddRefs(row)); if (row) { - const PRUnichar* colID; + nsCOMPtr colAtom; PRInt32 colIndex; - aCol->GetIdConst(&colID); + aCol->GetAtom(getter_AddRefs(colAtom)); aCol->GetIndex(&colIndex); PRUint32 count = row->GetChildCount(); @@ -1475,10 +1475,9 @@ nsXULTreeBuilder::GetTemplateActionCellFor(PRInt32 aRow, if (child->NodeInfo()->Equals(nsXULAtoms::treecell, kNameSpaceID_XUL)) { - if (colID[0] != 0 && + if (colAtom && child->AttrValueIs(kNameSpaceID_None, nsXULAtoms::ref, - nsDependentString(colID), - eCaseMatters)) { + colAtom, eCaseMatters)) { *aResult = child; break; } diff --git a/layout/xul/base/src/tree/src/nsTreeContentView.cpp b/layout/xul/base/src/tree/src/nsTreeContentView.cpp index b20437d5b7b9..9d716fd75ff2 100644 --- a/layout/xul/base/src/tree/src/nsTreeContentView.cpp +++ b/layout/xul/base/src/tree/src/nsTreeContentView.cpp @@ -1449,9 +1449,9 @@ nsTreeContentView::UpdateParentIndexes(PRInt32 aIndex, PRInt32 aSkip, PRInt32 aC nsIContent* nsTreeContentView::GetCell(nsIContent* aContainer, nsITreeColumn* aCol) { - const PRUnichar* colID; + nsCOMPtr colAtom; PRInt32 colIndex; - aCol->GetIdConst(&colID); + aCol->GetAtom(getter_AddRefs(colAtom)); aCol->GetIndex(&colIndex); // Traverse through cells, try to find the cell by "ref" attribute or by cell @@ -1463,9 +1463,8 @@ nsTreeContentView::GetCell(nsIContent* aContainer, nsITreeColumn* aCol) nsCOMPtr cell = *iter; if (cell->Tag() == nsXULAtoms::treecell) { - if (colID[0] != 0 && cell->AttrValueIs(kNameSpaceID_None, nsXULAtoms::ref, - nsDependentString(colID), - eCaseMatters)) { + if (colAtom && cell->AttrValueIs(kNameSpaceID_None, nsXULAtoms::ref, + colAtom, eCaseMatters)) { result = cell; break; }