All users were logged out of Bugzilla on October 13th, 2018

Cannot init gtk from XPCSHELL

VERIFIED DUPLICATE of bug 98952

Status

()

VERIFIED DUPLICATE of bug 98952
17 years ago
12 years ago

People

(Reporter: dolivari, Assigned: shaver)

Tracking

({crash})

Trunk
x86
Linux
crash
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010801
BuildID:    2001080104

As I tried to rewrite the nsAppRunner process in Java Script, I have been
confronted to the fact that nsICmdLineService can't be used from xpcshell
because there is no scriptable method to initialized it.

So you can't call nsIAppShellService::Initialize(in nsICmdLineService
aCmdLineService, in nsISupports nativeAppSupportOrSplashScreen) because your
nsICmdLineService object is invalid.

Initialize try to extract argv and argc to pass them to gtk_init and what I saw
is that gtk_init doesn't like it (Segmentation Fault).

Reproducible: Always
Steps to Reproduce:
Here's the code run under xpcshell :

var EventQClass =
Components.classes['@mozilla.org/event-queue-service;1'];

var EventQObj    = 
EventQClass.getService(Components.interfaces.nsIEventQueueService);

EventQObj.createThreadEventQueue();

var AppShellClass = Components.classes['@mozilla.org/appshell/appShellService;1'];
var AppShellObj =
AppShellClass.getService(Components.interfaces.nsIAppShellService);

var URLClass =  Components.classes['@mozilla.org/network/standard-url;1'];
var URLObj = URLClass.createInstance(Components.interfaces.nsIURL);

URLObj.scheme="file";
URLObj.path="/tmp/test.xul";

AppShellObj.Initialize(null,null);


var test = new Object();
toto = AppShellObj.CreateTopLevelWindow(null,URLObj,
    true,true,
    Components.interfaces.nsIWebBrowserChrome.CHROME_ALL,
    640,480,test);

AppShellObj.Run(); 


Actual Results:  If you try this code you'll get a segmentation fault from gtk.
In http://lxr.mozilla.org/mozilla/source/widget/src/gtk/nsAppShell.cpp#245

Expected Results:  I modified the code of
http://lxr.mozilla.org/mozilla/source/widget/src/gtk/nsAppShell.cpp#245

//gtk_init(&argc,&argv);
char ** t_argv = new char*;
t_argv[0] ="$MOZILLA/dist/bin/xpcshell";
int t_argc=1;
gtk_init (&t_argc,&t_argv);

And then a xul openned.
(Reporter)

Comment 1

17 years ago
Created attachment 48825 [details]
Sample XUL File

Comment 2

17 years ago
dolivari@eprocess.fr: is the sample XUL file you have attached
supposed to show the segmentation fault? When I load it and run it,
I do not crash on WinNT or Linux. Using Mozilla binaries 20010909xx.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 3

17 years ago
cc'ing dbradley, jband -
Keywords: crash

Comment 4

17 years ago
Could you not create your own XPCOM object that created, initialized, and
returned an instance of nsICmdLineService. This XPCOM object would have to
figure out the arguments using the appropriate system calls, or just pretend
there aren't any, much like your change does.

(Reporter)

Comment 5

17 years ago
> Could you not create your own XPCOM object that created, initialized, and
> returned an instance of nsICmdLineService. This XPCOM object would have to
> figure out the arguments using the appropriate system calls, or just pretend
> there aren't any, much like your change does.

That's what I planned to do but... Mike Shaver ask me to post a bug about this
after my post in netscape.public.mozilla.xpcom.

Phil Schwartau : the xul file attached is just a xul companion for the "bug".
(Reporter)

Comment 6

17 years ago

*** This bug has been marked as a duplicate of 98952 ***
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → DUPLICATE

Comment 7

17 years ago
Marking Verified Duplicate -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.