зеркало из https://github.com/mozilla/gecko-dev.git
use nsCOMPtr for the cached pref service instance. r=bryner.
This commit is contained in:
Родитель
045fa54dc1
Коммит
d7aaa45fbc
|
@ -18,7 +18,7 @@
|
||||||
* Rights Reserved.
|
* Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Seth Spitzer <sspitzer@netscape.com>
|
* Seth Spitzer <sspitzer@netscape.com>
|
||||||
* Alec Flett <alecf@netscape.com>
|
* Alec Flett <alecf@netscape.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -371,7 +371,6 @@ static const PRUnichar unicharEmptyString[] = { (PRUnichar)'\0' };
|
||||||
NS_IMPL_ISUPPORTS2(nsMessengerMigrator, nsIMessengerMigrator, nsIObserver)
|
NS_IMPL_ISUPPORTS2(nsMessengerMigrator, nsIMessengerMigrator, nsIObserver)
|
||||||
|
|
||||||
nsMessengerMigrator::nsMessengerMigrator() :
|
nsMessengerMigrator::nsMessengerMigrator() :
|
||||||
m_prefs(0),
|
|
||||||
m_haveShutdown(PR_FALSE),
|
m_haveShutdown(PR_FALSE),
|
||||||
m_oldMailType(-1),
|
m_oldMailType(-1),
|
||||||
m_alreadySetNntpDefaultLocalPath(PR_FALSE),
|
m_alreadySetNntpDefaultLocalPath(PR_FALSE),
|
||||||
|
@ -420,7 +419,9 @@ nsresult nsMessengerMigrator::Init()
|
||||||
nsresult
|
nsresult
|
||||||
nsMessengerMigrator::Shutdown()
|
nsMessengerMigrator::Shutdown()
|
||||||
{
|
{
|
||||||
if (m_prefs) nsServiceManager::ReleaseService(kPrefServiceCID, m_prefs);
|
if (m_prefs) {
|
||||||
|
m_prefs = null_nsCOMPtr();
|
||||||
|
}
|
||||||
|
|
||||||
m_haveShutdown = PR_TRUE;
|
m_haveShutdown = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -429,18 +430,19 @@ nsMessengerMigrator::Shutdown()
|
||||||
nsresult
|
nsresult
|
||||||
nsMessengerMigrator::getPrefService()
|
nsMessengerMigrator::getPrefService()
|
||||||
{
|
{
|
||||||
|
|
||||||
// get the prefs service
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (!m_prefs)
|
if (!m_prefs) {
|
||||||
rv = nsServiceManager::GetService(kPrefServiceCID,
|
m_prefs = do_GetService(kPrefServiceCID, &rv);
|
||||||
NS_GET_IID(nsIPref),
|
}
|
||||||
(nsISupports**)&m_prefs);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
/* m_prefs is good now */ return NS_OK;
|
if (!m_prefs) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMessengerMigrator::Observe(nsISupports *aSubject, const PRUnichar *aTopic, const PRUnichar *someData)
|
NS_IMETHODIMP nsMessengerMigrator::Observe(nsISupports *aSubject, const PRUnichar *aTopic, const PRUnichar *someData)
|
||||||
{
|
{
|
||||||
nsAutoString topicString(aTopic);
|
nsAutoString topicString(aTopic);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* Rights Reserved.
|
* Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* sspitzer@netscape.com
|
* Seth Spitzer <sspitzer@netscape.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
|
@ -121,7 +121,7 @@ private:
|
||||||
|
|
||||||
nsresult getPrefService();
|
nsresult getPrefService();
|
||||||
|
|
||||||
nsIPref *m_prefs;
|
nsCOMPtr <nsIPref> m_prefs;
|
||||||
PRBool m_haveShutdown;
|
PRBool m_haveShutdown;
|
||||||
PRInt32 m_oldMailType;
|
PRInt32 m_oldMailType;
|
||||||
PRBool m_alreadySetNntpDefaultLocalPath;
|
PRBool m_alreadySetNntpDefaultLocalPath;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче