Bug 969498 - [Qt] ICU usage conflict, ABORT: JS_SetICUMemoryFunctions failed. r=n.nethercote,nfroyd

This commit is contained in:
Oleg Romashin 2014-02-10 22:35:32 -08:00
parent 3ef61ffbe1
commit 0f88d2662e
3 changed files with 18 additions and 4 deletions

View File

@ -11,6 +11,7 @@
#include <MApplicationService>
#endif
#include "prenv.h"
#include "nsXPCOMPrivate.h"
#include <stdlib.h>
QApplication *nsQAppInstance::sQAppInstance = nullptr;
@ -29,6 +30,7 @@ void nsQAppInstance::AddRef(int& aArgc, char** aArgv, bool aDefaultProcess) {
QApplication::setGraphicsSystem(QString(graphicsSystem));
}
#endif
mozilla::SetICUMemoryFunctions();
sQAppInstance = new QApplication(aArgc, aArgv);
}
sQAppRefCount++;

View File

@ -194,6 +194,8 @@ namespace mozilla {
nsresult
ShutdownXPCOM(nsIServiceManager* servMgr);
void SetICUMemoryFunctions();
/**
* C++ namespaced version of NS_LogTerm.
*/

View File

@ -554,10 +554,7 @@ NS_InitXPCOM2(nsIServiceManager* *result,
// can't define the alloc/free functions in the JS engine, because it can't
// depend on the XPCOM-based memory reporting goop. So for now, we have
// this oddness.
if (!JS_SetICUMemoryFunctions(ICUReporter::Alloc, ICUReporter::Realloc,
ICUReporter::Free)) {
NS_RUNTIMEABORT("JS_SetICUMemoryFunctions failed.");
}
mozilla::SetICUMemoryFunctions();
// Initialize the JS engine.
if (!JS_Init()) {
@ -658,6 +655,19 @@ NS_ShutdownXPCOM(nsIServiceManager* servMgr)
namespace mozilla {
void
SetICUMemoryFunctions()
{
static bool sICUReporterInitialized = false;
if (!sICUReporterInitialized) {
if (!JS_SetICUMemoryFunctions(ICUReporter::Alloc, ICUReporter::Realloc,
ICUReporter::Free)) {
NS_RUNTIMEABORT("JS_SetICUMemoryFunctions failed.");
}
sICUReporterInitialized = true;
}
}
nsresult
ShutdownXPCOM(nsIServiceManager* servMgr)
{