fix for bug #2343 - Preferences are not initialized in the apprunner...

This commit is contained in:
rpotts%netscape.com 1999-03-16 07:15:37 +00:00
Родитель bd8eb2b8a9
Коммит b0a28d346e
2 изменённых файлов: 26 добавлений и 4 удалений

Просмотреть файл

@ -38,6 +38,7 @@ LINCS=-I$(PUBLIC)\raptor \
-I$(PUBLIC)\pref \
-I$(PUBLIC)\js \
-I$(PUBLIC)\dom \
-I$(PUBLIC)\pref \
-I$(PUBLIC)\rdf \
-I$(PUBLIC)\editor \
-I$(PUBLIC)\caps \

Просмотреть файл

@ -20,6 +20,7 @@
#include "nsIComponentManager.h"
#include "nsIURL.h"
#include "nsIWidget.h"
#include "nsIPref.h"
#include "plevent.h"
#include "nsIAppShell.h"
@ -39,6 +40,7 @@ static struct MacInitializer { MacInitializer() { InitializeMacToolbox(); } } gI
/* Define Class IDs */
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
/* Define Interface IDs */
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
@ -98,12 +100,14 @@ int main(int argc, char* argv[])
nsIAppShellService* appShell;
nsIDOMAppCoresManager *appCoresManager;
nsIURL* url;
nsIPref *prefs;
/*
* initialize all variables that are NS_IF_RELEASE(...) during
* cleanup...
*/
url = nsnull;
prefs = nsnull;
appShell = nsnull;
cmdLineArgs = nsnull;
appCoresManager = nsnull;
@ -119,6 +123,17 @@ int main(int argc, char* argv[])
// XXX: This call will be replaced by a registry initialization...
NS_SetupRegistry_1();
/*
* Load preferences
*/
rv = nsServiceManager::GetService(kPrefCID,
nsIPref::GetIID(),
(nsISupports **)&prefs);
if (NS_FAILED(rv)) {
goto done;
}
prefs->Startup("prefs.js");
/*
* Start up the core services:
* - Command-line processor.
@ -358,6 +373,12 @@ done:
nsServiceManager::ReleaseService(kAppCoresManagerCID, appCoresManager);
}
/* Release the global preferences... */
if (prefs) {
prefs->Shutdown();
nsServiceManager::ReleaseService(kPrefCID, prefs);
}
/*
* Translate the nsresult into an appropriate platform-specific return code.
*/