Bug 1338574 - Part 2: Use MOZ_CRASH_UNSAFE_PRINTF in Media. r=jwwang, a=NPOTB
authorEmanuel Hoogeveen <emanuel.hoogeveen@gmail.com>
Tue, 21 Feb 2017 18:01:45 +0100
changeset 578474 50e120d7ac64a36aff6c4392b1e972bad2b0f95f
parent 578473 337398a83aa5168326f57177dd496b06c213130f
child 578475 2d4da5a366e8e24e8db8133ac14890d66e3aa3cb
push id58939
push userbmo:cku@mozilla.com
push dateTue, 16 May 2017 04:17:59 +0000
reviewersjwwang, NPOTB
bugs1338574
milestone52.1.2
Bug 1338574 - Part 2: Use MOZ_CRASH_UNSAFE_PRINTF in Media. r=jwwang, a=NPOTB
dom/media/MediaShutdownManager.cpp
--- a/dom/media/MediaShutdownManager.cpp
+++ b/dom/media/MediaShutdownManager.cpp
@@ -71,24 +71,17 @@ MediaShutdownManager::InitStatics()
 
   sInitDone = true;
   sInstance = new MediaShutdownManager();
 
   nsresult rv = GetShutdownBarrier()->AddBlocker(
     sInstance, NS_LITERAL_STRING(__FILE__), __LINE__,
     NS_LITERAL_STRING("MediaShutdownManager shutdown"));
   if (NS_FAILED(rv)) {
-    // Leak the buffer on the heap to make sure that it lives long enough,
-    // as MOZ_CRASH_ANNOTATE expects the pointer passed to it to live to
-    // the end of the program.
-    const size_t CAPACITY = 256;
-    auto buf = new char[CAPACITY];
-    snprintf(buf, CAPACITY, "Failed to add shutdown blocker! rv=%x", uint32_t(rv));
-    MOZ_CRASH_ANNOTATE(buf);
-    MOZ_REALLY_CRASH();
+    MOZ_CRASH_UNSAFE_PRINTF("Failed to add shutdown blocker! rv=%x", uint32_t(rv));
   }
 }
 
 void
 MediaShutdownManager::RemoveBlocker()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mIsDoingXPCOMShutDown);