Bug 447593 Crash [@ NS_NewAtom] r=bsmedberg

This commit is contained in:
Neil Rashbrook 2008-08-11 21:26:40 +01:00
Родитель f3b571148e
Коммит 0ed8934625
3 изменённых файлов: 6 добавлений и 24 удалений

Просмотреть файл

@ -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(&currentIndex);
/*
if (index == currentIndex) {
nsCOMPtr<nsIAtomService> atomSvc = do_GetService("@mozilla.org/atom-service;1");
nsCOMPtr<nsIAtom> 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<nsIAtomService> atomSvc = do_GetService("@mozilla.org/atom-service;1");
nsCOMPtr<nsIAtom> atom;
atomSvc->GetAtom(className.get(), getter_AddRefs(atom));
nsCOMPtr<nsIAtom> atom(do_GetAtom(className));
properties->AppendElement(atom);
}
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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.