Bug 1081283 - Use the correct calling convention on InitDwriteBG; r=jrmuizel
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 10 Oct 2014 18:30:46 -0400
changeset 209967 4ef90fdc2c5895c81cdf6434ce54a88dd7b3d499
parent 209966 d27ce1e75719e417328b570bec2c6dbcbd5e1de7
child 209968 94e7f3c3969c899f753098afb6639b811fbc7d1c
push id27632
push userryanvm@gmail.com
push dateSat, 11 Oct 2014 20:21:25 +0000
treeherdermozilla-central@44168a7af20d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1081283
milestone35.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 1081283 - Use the correct calling convention on InitDwriteBG; r=jrmuizel Otherwise our stack is misaligned by the time we return from this. This misalignment doesn't cause a crash with the Winodws thread startup code, but it does with ASAN because it does many things after the thread entry point exits.
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2848,17 +2848,17 @@ static void LogRegistryEvent(const wchar
   }
 }
 #else
 
 #define LOGREGISTRY(msg)
 
 #endif
 
-static DWORD InitDwriteBG(LPVOID lpdwThreadParam)
+static DWORD WINAPI InitDwriteBG(LPVOID lpdwThreadParam)
 {
   SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN);
   LOGREGISTRY(L"loading dwrite.dll");
   HMODULE dwdll = LoadLibraryW(L"dwrite.dll");
   if (dwdll) {
     decltype(DWriteCreateFactory)* createDWriteFactory = (decltype(DWriteCreateFactory)*)
       GetProcAddress(dwdll, "DWriteCreateFactory");
     if (createDWriteFactory) {
@@ -3038,18 +3038,17 @@ XREMain::XRE_mainInit(bool* aExitFlag)
     // calls cause the IDWriteFactory object to communicate with the FntCache
     // service with a timeout; if there's no response after the timeout, the
     // DirectWrite client library will assume the service isn't around and do
     // manual font file I/O on _all_ system fonts.  To avoid this, load the
     // dwrite library and create a factory as early as possible so that the
     // FntCache service is ready by the time it's needed.
 
     if (IsVistaOrLater()) {
-      CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)&InitDwriteBG,
-                   nullptr, 0, nullptr);
+      CreateThread(nullptr, 0, &InitDwriteBG, nullptr, 0, nullptr);
     }
   }
 #endif
 
 #ifdef XP_UNIX
   const char *home = PR_GetEnv("HOME");
   if (!home || !*home) {
     struct passwd *pw = getpwuid(geteuid());