Bug 1562948: Use a multi-threaded apartment inside AnnotateWMIData_ThreadStart; r=mhowell
authorAaron Klotz <aklotz@mozilla.com>
Tue, 02 Jul 2019 22:22:32 +0000
changeset 540693 42a9ef2a777fb841ab9918e10e2629902c7bd28e
parent 540692 53b7325a470a96c4ec659d57d6465308dba02020
child 540694 b7c9d1d5a935bfd94a36db41fb44baa09c1e8ad0
child 540736 f2bacc7bfee31ac349cc418c305cb7571fb17515
push id11529
push userarchaeopteryx@coole-files.de
push dateThu, 04 Jul 2019 15:22:33 +0000
treeherdermozilla-beta@ebb510a784b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1562948
milestone69.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 1562948: Use a multi-threaded apartment inside AnnotateWMIData_ThreadStart; r=mhowell Using a single-threaded apartment creates a race condition that triggers a crash in a11y when it hooks InSendMessageEx. Since we're on a background thread, we don't have a strongly compelling reason to use an STA when an MTA will work just fine. Differential Revision: https://phabricator.services.mozilla.com/D36677
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3596,25 +3596,22 @@ static void AnnotateWMIData() {
     CrashReporter::AnnotateCrashReport(
         CrashReporter::Annotation::MemoryErrorCorrection, valueString);
   }
 
   VariantClear(&value);
 }
 
 static void PR_CALLBACK AnnotateWMIData_ThreadStart(void*) {
-  HRESULT hr = CoInitialize(nullptr);
-
-  if (FAILED(hr)) {
+  mscom::MTARegion mta;
+  if (!mta.IsValid()) {
     return;
   }
 
   AnnotateWMIData();
-
-  CoUninitialize();
 }
 #endif  // XP_WIN
 
 #if defined(XP_LINUX) && !defined(ANDROID)
 
 static void AnnotateLSBRelease(void*) {
   nsCString dist, desc, release, codename;
   if (widget::lsb::GetLSBRelease(dist, desc, release, codename)) {