Bug 522948 - crash at shutdown with geo.enabled=false [@nsCOMArray_base::InsertObjectAt(nsISupports*, int)]. r=dougt

This commit is contained in:
Elmar Ludwig 2009-10-25 22:50:16 -07:00
parent a116a29917
commit ab3b004ea6

View File

@ -365,12 +365,6 @@ GeoEnabledChangedCallback(const char *aPrefName, void *aClosure)
nsresult nsGeolocationService::Init()
{
nsCOMPtr<nsIObserverService> obs = do_GetService("@mozilla.org/observer-service;1");
if (!obs)
return NS_ERROR_FAILURE;
obs->AddObserver(this, "quit-application", false);
mTimeout = nsContentUtils::GetIntPref("geo.timeout", 6000);
nsContentUtils::RegisterPrefCallback("geo.enabled",
@ -391,6 +385,13 @@ nsresult nsGeolocationService::Init()
if (!catMan)
return NS_ERROR_FAILURE;
// geolocation service can be enabled -> now register observer
nsCOMPtr<nsIObserverService> obs = do_GetService("@mozilla.org/observer-service;1");
if (!obs)
return NS_ERROR_FAILURE;
obs->AddObserver(this, "quit-application", false);
nsCOMPtr<nsISimpleEnumerator> geoproviders;
catMan->EnumerateCategory("geolocation-provider", getter_AddRefs(geoproviders));
if (geoproviders) {