mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Don't crash if there are command-line arguments (bug 261734) by doing ParseConfig before ParseArgs, moving gtk_init to RunWizard, and adding a check in ErrorHandler to log errors to the console if gtk hasn't been initialized yet. r=ajschultz, sr=dveditz.
This commit is contained in:
parent
c95ace691a
commit
ea8b458e37
@ -156,7 +156,7 @@ BAIL:
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstaller::RunWizard()
|
||||
nsXInstaller::RunWizard(int argc, char **argv)
|
||||
{
|
||||
int err = OK;
|
||||
|
||||
@ -164,6 +164,7 @@ nsXInstaller::RunWizard()
|
||||
|
||||
// create the dialog window
|
||||
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT) {
|
||||
gtk_init(&argc, &argv);
|
||||
gCtx->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
XI_VERIFY(gCtx->window);
|
||||
|
||||
@ -407,15 +408,13 @@ main(int argc, char **argv)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((err = installer->ParseArgs(argc, argv)) != OK)
|
||||
goto out;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
if ((err = installer->ParseConfig()) != OK)
|
||||
goto out;
|
||||
|
||||
err = installer->RunWizard();
|
||||
if ((err = installer->ParseArgs(argc, argv)) != OK)
|
||||
goto out;
|
||||
|
||||
err = installer->RunWizard(argc, argv);
|
||||
|
||||
out:
|
||||
XI_IF_DELETE(installer);
|
||||
@ -447,7 +446,9 @@ ErrorHandler(int aErr, const char* aErrMsg)
|
||||
sprintf(msg, gCtx->Res("FATAL_ERROR"), aErr, gCtx->Res(errStr));
|
||||
}
|
||||
|
||||
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT) {
|
||||
// lack of gCtx->window indicates we have not yet run RunWizard
|
||||
// and gtk_init
|
||||
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT || !gCtx->window) {
|
||||
fprintf (stderr, "%s\n", msg);
|
||||
return aErr;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
|
||||
int ParseArgs(int aArgc, char **aArgv);
|
||||
int ParseConfig();
|
||||
int RunWizard();
|
||||
int RunWizard(int argc, char **argv);
|
||||
int ParseGeneral(nsINIParser *aParser);
|
||||
|
||||
static gint Kill(GtkWidget *widget, GdkEvent *event, gpointer data);
|
||||
|
Loading…
Reference in New Issue
Block a user