Closed Bug 569121 Opened 14 years ago Closed 14 years ago

gArgc/gArgv are destroyed in content process.

Categories

(Core :: IPC, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: romaxa, Unassigned)

Details

Attachments

(1 file)

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, 
    aStaticComponentCount=0)
    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
Attachment #448265 - Flags: review? → review?(benjamin)
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?
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.
*What* arguments? You're obviously trying to solve a specific problem here. What is it?
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:
http://mxr.mozilla.org/mozilla-central/source/toolkit/xre/nsQAppInstance.cpp#61
(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...
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.
Ok, seems we don't want to initialize Meegotouch in child process, and bug does not make sense anymore.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
Attachment #448265 - Flags: review?(benjamin)
Ok, we still need to solve this problem somehow, because QApplication don't like 0 size argiments value
http://doc.trolltech.com/4.6/qapplication.html#QApplication
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.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Ok, we have workaround for this bug, we are adding one argument for child process QApplication
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: