Bug 447593 Crash [@ NS_NewAtom] r=bsmedberg
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Mon, 11 Aug 2008 21:26:40 +0100
changeset 16562 116a48494857e3755d47e14e4279a88bc29da20a
parent 16561 ef7b855aa43dffafd6f28634d63bcca4247f07d1
child 16563 a2837ff832c9b960313d6c8a172680241d075b8d
push id1135
push userneil@parkwaycc.co.uk
push dateMon, 11 Aug 2008 20:26:55 +0000
treeherdermozilla-central@116a48494857 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs447593
milestone1.9.1a2pre
Bug 447593 Crash [@ NS_NewAtom] r=bsmedberg
toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
xpcom/ds/nsAtomService.cpp
xpcom/ds/nsIAtomService.idl
--- a/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
@@ -701,45 +701,27 @@ nsAutoCompleteController::GetRowCount(PR
 {
   *aRowCount = mRowCount;
   return NS_OK;
 }
 
 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);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/xpcom/ds/nsAtomService.cpp
+++ b/xpcom/ds/nsAtomService.cpp
@@ -41,28 +41,28 @@
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsAtomService, nsIAtomService)
 
 nsAtomService::nsAtomService()
 {
 }
 
 nsresult
-nsAtomService::GetAtom(const PRUnichar *aString, nsIAtom ** aResult)
+nsAtomService::GetAtom(const nsAString& aString, nsIAtom ** aResult)
 {
   *aResult = NS_NewAtom(aString);
 
   if (!*aResult)
     return NS_ERROR_OUT_OF_MEMORY;
   
   return NS_OK;
 }
 
 nsresult
-nsAtomService::GetPermanentAtom(const PRUnichar *aString, nsIAtom ** aResult)
+nsAtomService::GetPermanentAtom(const nsAString& aString, nsIAtom ** aResult)
 {
   *aResult = NS_NewPermanentAtom(aString);
 
   if (!*aResult)
     return NS_ERROR_OUT_OF_MEMORY;
   
   return NS_OK;
 }
--- a/xpcom/ds/nsIAtomService.idl
+++ b/xpcom/ds/nsIAtomService.idl
@@ -52,29 +52,29 @@
 %}
 
 /*
  * Should this really be scriptable?  Using atoms from script or proxies
  * could be dangerous since double-wrapping could lead to loss of
  * 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.
    */
   [noscript] nsIAtom getAtomUTF8(in string value);
   [noscript] nsIAtom getPermanentAtomUTF8(in string value);
 };