From 73d06dd06ed77920c29ee9ee258e3f6780e2cdcb Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 19 Aug 2010 14:50:17 -0500 Subject: [PATCH] Bug 588911: Initialize gArgc/v earlier in XRE_InitParentProcess(). r=bent a=test-only --- toolkit/xre/nsAppRunner.cpp | 2 ++ toolkit/xre/nsEmbedFunctions.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 3509aeb672a..f4062353560 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -470,6 +470,8 @@ static void RemoveArg(char **argv) static ArgResult CheckArg(const char* aArg, PRBool aCheckOSInt = PR_FALSE, const char **aParam = nsnull, PRBool aRemArg = PR_TRUE) { + NS_ABORT_IF_FALSE(gArgv, "gArgv must be initialized before CheckArg()"); + char **curarg = gArgv + 1; // skip argv[0] ArgResult ar = ARG_NONE; diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 32ba8403c02..b3441abcfef 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -492,7 +492,9 @@ XRE_InitParentProcess(int aArgc, NS_ENSURE_ARG_POINTER(aArgv); NS_ENSURE_ARG_POINTER(aArgv[0]); - int rv = XRE_InitCommandLine(aArgc, aArgv); + gArgc = aArgc; + gArgv = aArgv; + int rv = XRE_InitCommandLine(gArgc, gArgv); if (NS_FAILED(rv)) return NS_ERROR_FAILURE;