gArgc/gArgv are destroyed in content process.




8 years ago
8 years ago


(Reporter: romaxa, Unassigned)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



8 years ago
XRE_InitEmbedding initialization does:
    static char* kNullCommandLine[] = { nsnull };
    gArgv = kNullCommandLine;
    gArgc = 0;

And that is destroying gArgc initialized in XRE_InitChildProcess

#0  XRE_InitEmbedding (aLibXULDirectory=0xb201c180, aAppDirectory=0xb201c180, aAppDirProvider=0x0, aStaticComponents=0x0, 
    at toolkit/xre/nsEmbedFunctions.cpp:173
#1  0xb6f48401 in mozilla::ipc::ScopedXREEmbed::Start (this=0xb20311b4)
    at ipc/glue/ScopedXREEmbed.cpp:89
#2  0xb6f0671b in mozilla::dom::ContentProcessProcess::Init (this=0xb2031020)
    at dom/ipc/ContentProcessProcess.cpp:55
#3  0xb5c23c55 in XRE_InitChildProcess (aArgc=2, aArgv=0xbfa100b4, aProcess=GeckoProcessType_Content)
    at toolkit/xre/nsEmbedFunctions.cpp:451
#4  0x0804909b in main (argc=-1803731676, argv=0x0)
    at ipc/app/MozillaRuntimeMain.cpp:87

Comment 1

8 years ago
Created attachment 448265 [details] [diff] [review]
Don't re-init argc/argv if argc not 0
Attachment #448265 - Flags: review?


8 years ago
Attachment #448265 - Flags: review? → review?(benjamin)

Comment 2

8 years ago
gArgc is a hack used by the XRE code. If you're using it from outside that code, something is wrong. What is the symptom you're trying to fix?

Comment 3

8 years ago
I'm running e10s fennec, with e10s plugins, and trying to keep all related arguments and allow to use them by plugin...

But we are loosing all cmdline arguments on this stage.

Comment 4

8 years ago
*What* arguments? You're obviously trying to solve a specific problem here. What is it?

Comment 5

8 years ago
Plugin need to initialize Qt-touch library (meegotouch), and that is need to be initialized with argc/argv arguments.

Plugin getting argc/argv values from qApp->arguments(). and giving it to MComponentData class.
MComponentData class checking argv[0] (application name), and if application name not detected (or argc == 0), then it just exit.

QApplication for plugin/content  initialized here:

Comment 6

8 years ago
(In reply to comment #2)
> gArgc is a hack used by the XRE code. If you're using it from outside that
> code, something is wrong. What is the symptom you're trying to fix?

QApplication initialized using gArgv/c, and MComponentData (meegotouch) initialized using qApp->arguments(), and if those arguments empty it is deciding that something wrong...

Comment 7

8 years ago
This feels very wrong. Nobody (including QApplication!) ought to be using gArgv/gArgc. They should only be valid for the XRE_main codepath, and even then they are mainly there to serve the needs of the code in nsAppRunner.cpp.

It sounds like you ought to be initializing QApplication explicitly.

Comment 8

8 years ago
Ok, seems we don't want to initialize Meegotouch in child process, and bug does not make sense anymore.
Last Resolved: 8 years ago
Resolution: --- → INVALID


8 years ago
Attachment #448265 - Flags: review?(benjamin)

Comment 9

8 years ago
Ok, we still need to solve this problem somehow, because QApplication don't like 0 size argiments value
Warning: The data referred to by argc and argv must stay valid for the entire lifetime of the QApplication object. In addition, argc must be greater than zero and argv must contain at least one valid character string.

I think we should add at least binary name argument to gArgv gArgc or addd it only for nsQAppInstance class.
Resolution: INVALID → ---

Comment 10

8 years ago
Ok, we have workaround for this bug, we are adding one argument for child process QApplication
Last Resolved: 8 years ago8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.