зеркало из https://github.com/mozilla/pjs.git
Register bookmarks datasource with RDF service *last*, because an other failure will leave the RDF service with a dangling pointer. Also, add assertion if we're unable to create a timer, because this is an *extremely* common platform porting error. r=rjc
This commit is contained in:
Родитель
902b10802f
Коммит
34c01f23ce
|
@ -1922,10 +1922,6 @@ nsBookmarksService::Init()
|
||||||
rv = bm_AddRefGlobals();
|
rv = bm_AddRefGlobals();
|
||||||
if (NS_FAILED(rv)) return(rv);
|
if (NS_FAILED(rv)) return(rv);
|
||||||
|
|
||||||
// register this as a named data source with the RDF service
|
|
||||||
rv = gRDF->RegisterDataSource(this, PR_FALSE);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
/* create a URL for the string resource file */
|
/* create a URL for the string resource file */
|
||||||
nsCOMPtr<nsIIOService> pNetService;
|
nsCOMPtr<nsIIOService> pNetService;
|
||||||
if (NS_SUCCEEDED(rv = nsServiceManager::GetService(kIOServiceCID, NS_GET_IID(nsIIOService),
|
if (NS_SUCCEEDED(rv = nsServiceManager::GetService(kIOServiceCID, NS_GET_IID(nsIIOService),
|
||||||
|
@ -2005,11 +2001,19 @@ nsBookmarksService::Init()
|
||||||
{
|
{
|
||||||
busySchedule = PR_FALSE;
|
busySchedule = PR_FALSE;
|
||||||
mTimer = do_CreateInstance("component://netscape/timer", &rv);
|
mTimer = do_CreateInstance("component://netscape/timer", &rv);
|
||||||
|
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create a timer");
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
mTimer->Init(nsBookmarksService::FireTimer, this, BOOKMARK_TIMEOUT, NS_PRIORITY_LOWEST, NS_TYPE_REPEATING_SLACK);
|
mTimer->Init(nsBookmarksService::FireTimer, this, BOOKMARK_TIMEOUT, NS_PRIORITY_LOWEST, NS_TYPE_REPEATING_SLACK);
|
||||||
// Note: don't addref "this" as we'll cancel the timer in the nsBookmarkService destructor
|
// Note: don't addref "this" as we'll cancel the timer in the nsBookmarkService destructor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// register this as a named data source with the RDF
|
||||||
|
// service. Do this *last*, because if Init() fails, then the
|
||||||
|
// object will be destroyed (leaving the RDF service with a
|
||||||
|
// dangling pointer).
|
||||||
|
rv = gRDF->RegisterDataSource(this, PR_FALSE);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче