Bug 741052 - Null check nsMediaCache::mFileCache in nsMediaCache destructor. r=roc
authorChris Pearce <cpearce@mozilla.com>
Mon, 02 Apr 2012 10:34:11 +1200
changeset 94141 0dde67a8f4ea8f02a29e39892a9c677e476e4f50
parent 94140 f5c4aedd43a6da1196f241176074370a2ffbe2d5
child 94142 f4df291002dd9a77d79d32fca0c9f53a30b2cae6
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs741052
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 741052 - Null check nsMediaCache::mFileCache in nsMediaCache destructor. r=roc
content/media/nsMediaCache.cpp
--- a/content/media/nsMediaCache.cpp
+++ b/content/media/nsMediaCache.cpp
@@ -143,18 +143,20 @@ public:
 #endif
   {
     MOZ_COUNT_CTOR(nsMediaCache);
   }
   ~nsMediaCache() {
     NS_ASSERTION(mStreams.IsEmpty(), "Stream(s) still open!");
     Truncate();
     NS_ASSERTION(mIndex.Length() == 0, "Blocks leaked?");
-    mFileCache->Close();
-    mFileCache = nsnull;
+    if (mFileCache) {
+      mFileCache->Close();
+      mFileCache = nsnull;
+    }
     MOZ_COUNT_DTOR(nsMediaCache);
   }
 
   // Main thread only. Creates the backing cache file. If this fails,
   // then the cache is still in a semi-valid state; mFD will be null,
   // so all I/O on the cache file will fail.
   nsresult Init();
   // Shut down the global cache if it's no longer needed. We shut down