Bug 997963, part 3 - Make bundleCacheEntry_t::mHashKey into an nsAutoPtr. r=ehsan
authorAndrew McCreight <continuation@gmail.com>
Mon, 21 Apr 2014 09:41:57 -0700
changeset 179406 29173518f045ec4da474a50c6c2b6e7f08d87638
parent 179405 d5f5047b958510c1002fd34c1c9d227429ff29c0
child 179407 b7694e60758e8feaf4700285307b449722f4f441
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehsan
bugs997963
milestone31.0a1
Bug 997963, part 3 - Make bundleCacheEntry_t::mHashKey into an nsAutoPtr. r=ehsan
intl/strres/src/nsStringBundle.cpp
--- a/intl/strres/src/nsStringBundle.cpp
+++ b/intl/strres/src/nsStringBundle.cpp
@@ -483,17 +483,17 @@ nsresult nsExtensibleStringBundle::GetSi
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////
 
 #define MAX_CACHED_BUNDLES 16
 
 struct bundleCacheEntry_t : public LinkedListElement<bundleCacheEntry_t> {
-  nsCStringKey *mHashKey;
+  nsAutoPtr<nsCStringKey> mHashKey;
   // do not use a nsCOMPtr - this is a struct not a class!
   nsIStringBundle* mBundle;
 };
 
 
 nsStringBundleService::nsStringBundleService() :
   mBundleMap(MAX_CACHED_BUNDLES, true)
 {
@@ -653,17 +653,16 @@ nsStringBundleService::insertIntoCache(n
   mBundleMap.Put(cacheEntry->mHashKey, cacheEntry);
 
   return cacheEntry;
 }
 
 void
 nsStringBundleService::recycleEntry(bundleCacheEntry_t *aEntry)
 {
-  delete aEntry->mHashKey;
   NS_RELEASE(aEntry->mBundle);
 }
 
 NS_IMETHODIMP
 nsStringBundleService::CreateBundle(const char* aURLSpec,
                                     nsIStringBundle** aResult)
 {
 #ifdef DEBUG_tao_