From 93a5504ec37e13b1880b928bcddc481597d65fee Mon Sep 17 00:00:00 2001 From: Neil Rashbrook Date: Mon, 11 Aug 2008 21:26:40 +0100 Subject: [PATCH] Bug 447593 Crash [@ NS_NewAtom] r=bsmedberg --- .../src/nsAutoCompleteController.cpp | 20 +------------------ xpcom/ds/nsAtomService.cpp | 4 ++-- xpcom/ds/nsIAtomService.idl | 6 +++--- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp b/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp index cd4db9e4e451..615e4cd1afc3 100644 --- a/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp +++ b/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp @@ -706,35 +706,17 @@ nsAutoCompleteController::GetRowCount(PRInt32 *aRowCount) NS_IMETHODIMP nsAutoCompleteController::GetRowProperties(PRInt32 index, nsISupportsArray *properties) { - // XXX This is a hack because the tree doesn't seem to be painting the selected row - // the normal way. Please remove this ASAP. - PRInt32 currentIndex; - mSelection->GetCurrentIndex(¤tIndex); - - /* - if (index == currentIndex) { - nsCOMPtr atomSvc = do_GetService("@mozilla.org/atom-service;1"); - nsCOMPtr atom; - atomSvc->GetAtom(NS_LITERAL_STRING("menuactive").get(), getter_AddRefs(atom)); - properties->AppendElement(atom); - } - */ - return NS_OK; } NS_IMETHODIMP nsAutoCompleteController::GetCellProperties(PRInt32 row, nsITreeColumn* col, nsISupportsArray* properties) { - GetRowProperties(row, properties); - if (row >= 0) { nsAutoString className; GetStyleAt(row, className); if (!className.IsEmpty()) { - nsCOMPtr atomSvc = do_GetService("@mozilla.org/atom-service;1"); - nsCOMPtr atom; - atomSvc->GetAtom(className.get(), getter_AddRefs(atom)); + nsCOMPtr atom(do_GetAtom(className)); properties->AppendElement(atom); } } diff --git a/xpcom/ds/nsAtomService.cpp b/xpcom/ds/nsAtomService.cpp index 9a52776d8057..6369eda49f85 100644 --- a/xpcom/ds/nsAtomService.cpp +++ b/xpcom/ds/nsAtomService.cpp @@ -46,7 +46,7 @@ nsAtomService::nsAtomService() } nsresult -nsAtomService::GetAtom(const PRUnichar *aString, nsIAtom ** aResult) +nsAtomService::GetAtom(const nsAString& aString, nsIAtom ** aResult) { *aResult = NS_NewAtom(aString); @@ -57,7 +57,7 @@ nsAtomService::GetAtom(const PRUnichar *aString, nsIAtom ** aResult) } nsresult -nsAtomService::GetPermanentAtom(const PRUnichar *aString, nsIAtom ** aResult) +nsAtomService::GetPermanentAtom(const nsAString& aString, nsIAtom ** aResult) { *aResult = NS_NewPermanentAtom(aString); diff --git a/xpcom/ds/nsIAtomService.idl b/xpcom/ds/nsIAtomService.idl index 1820527e942d..89edae5e807e 100644 --- a/xpcom/ds/nsIAtomService.idl +++ b/xpcom/ds/nsIAtomService.idl @@ -57,20 +57,20 @@ * pointer identity. */ -[scriptable, uuid(8c0e6018-6a06-47f5-bfa1-2e051705c9de)] +[scriptable, uuid(9c1f50b9-f9eb-42d4-a8cb-2c7600aeb241)] interface nsIAtomService : nsISupports { /** * Version of NS_NewAtom that doesn't require linking against the * XPCOM library. See nsIAtom.idl. */ - nsIAtom getAtom(in wstring value); + nsIAtom getAtom(in AString value); /** * Version of NS_NewPermanentAtom that doesn't require linking against * the XPCOM library. See nsIAtom.idl. */ - nsIAtom getPermanentAtom(in wstring value); + nsIAtom getPermanentAtom(in AString value); /** * Get an atom with a utf8 string.