Bug 1414318 - Turn off |StartWriter| in leak checking builds. r=mccr8
☠☠ backed out by 0418d4d4a91e ☠ ☠
authorEric Rahm <erahm@mozilla.com>
Fri, 03 Nov 2017 14:17:57 -0700
changeset 434931 b1ce6a65a2141c6ad7f8b3c83333878d976f75c2
parent 434862 531d0b700225294144914cc606b8f2130707e7db
child 434932 4f5a502acbe831a1d17d5af06efd63c0b3081a8e
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersmccr8
bugs1414318
milestone58.0a1
Bug 1414318 - Turn off |StartWriter| in leak checking builds. r=mccr8
toolkit/components/terminator/nsTerminator.cpp
toolkit/components/terminator/tests/xpcshell/xpcshell.ini
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -223,17 +223,18 @@ void RunWriter(void* arg)
   NS_SetCurrentThreadName("Shutdown Statistics Writer");
 
   MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(arg);
   // Shutdown will generally complete before we have a chance to
   // deallocate. This is not a leak.
 
   // Setup destinationPath and tmpFilePath
 
-  nsCString destinationPath(static_cast<char*>(arg));
+  nsCString destinationPath;
+  destinationPath.Adopt(static_cast<char*>(arg));
   nsAutoCString tmpFilePath;
   tmpFilePath.Append(destinationPath);
   tmpFilePath.AppendLiteral(".tmp");
 
   // Cleanup any file leftover from a previous run
   Unused << PR_Delete(tmpFilePath.get());
   Unused << PR_Delete(destinationPath.get());
 
@@ -356,22 +357,22 @@ nsTerminator::SelfInit()
 }
 
 // Actually launch these threads. This takes place at the first sign of shutdown.
 void
 nsTerminator::Start()
 {
   MOZ_ASSERT(!mInitialized);
   StartWatchdog();
-#if !defined(DEBUG)
-  // Only allow nsTerminator to write on non-debug builds so we don't get leak warnings on
-  // shutdown for intentional leaks (see bug 1242084). This will be enabled again by bug
-  // 1255484 when 1255478 lands.
+#if !defined(NS_FREE_PERMANENT_DATA)
+  // Only allow nsTerminator to write on non-leak-checked builds so we don't
+  // get leak warnings on shutdown for intentional leaks (see bug 1242084).
+  // This will be enabled again by bug 1255484 when 1255478 lands.
   StartWriter();
-#endif // !defined(DEBUG)
+#endif // !defined(NS_FREE_PERMANENT_DATA)
   mInitialized = true;
 }
 
 // Prepare, allocate and start the watchdog thread.
 // By design, it will never finish, nor be deallocated.
 void
 nsTerminator::StartWatchdog()
 {
--- a/toolkit/components/terminator/tests/xpcshell/xpcshell.ini
+++ b/toolkit/components/terminator/tests/xpcshell/xpcshell.ini
@@ -1,7 +1,7 @@
 [DEFAULT]
 head=
 
 [test_terminator_record.js]
-skip-if = debug # Disabled by bug 1242084, bug 1255484 will enable it again.
+skip-if = asan # Disabled by bug 1242084, bug 1255484 will enable it again.
 [test_terminator_reload.js]
 skip-if = os == "android"