зеркало из https://github.com/mozilla/gecko-dev.git
Bug 835408 - nsVolume NameStr and MountPointStr noe return nsCString rather than ptr to freed memory. r=jlebar
This commit is contained in:
Родитель
c3979e5b53
Коммит
e69de7d4fa
|
@ -101,12 +101,12 @@ nsVolume::LogState() const
|
||||||
{
|
{
|
||||||
if (mState == nsIVolume::STATE_MOUNTED) {
|
if (mState == nsIVolume::STATE_MOUNTED) {
|
||||||
LOG("nsVolume: %s state %s @ '%s' gen %d locked %d",
|
LOG("nsVolume: %s state %s @ '%s' gen %d locked %d",
|
||||||
NameStr(), StateStr(), MountPointStr(),
|
NameStr().get(), StateStr(), MountPointStr().get(),
|
||||||
MountGeneration(), (int)IsMountLocked());
|
MountGeneration(), (int)IsMountLocked());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("nsVolume: %s state %s", NameStr(), StateStr());
|
LOG("nsVolume: %s state %s", NameStr().get(), StateStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsVolume::Set(const nsVolume* aVolume)
|
void nsVolume::Set(const nsVolume* aVolume)
|
||||||
|
|
|
@ -60,13 +60,13 @@ public:
|
||||||
void LogState() const;
|
void LogState() const;
|
||||||
|
|
||||||
const nsString& Name() const { return mName; }
|
const nsString& Name() const { return mName; }
|
||||||
const char* NameStr() const { return NS_LossyConvertUTF16toASCII(mName).get(); }
|
nsCString NameStr() const { return NS_LossyConvertUTF16toASCII(mName); }
|
||||||
|
|
||||||
int32_t MountGeneration() const { return mMountGeneration; }
|
int32_t MountGeneration() const { return mMountGeneration; }
|
||||||
bool IsMountLocked() const { return mMountLocked; }
|
bool IsMountLocked() const { return mMountLocked; }
|
||||||
|
|
||||||
const nsString& MountPoint() const { return mMountPoint; }
|
const nsString& MountPoint() const { return mMountPoint; }
|
||||||
const char* MountPointStr() const { return NS_LossyConvertUTF16toASCII(mMountPoint).get(); }
|
nsCString MountPointStr() const { return NS_LossyConvertUTF16toASCII(mMountPoint); }
|
||||||
|
|
||||||
int32_t State() const { return mState; }
|
int32_t State() const { return mState; }
|
||||||
const char* StateStr() const { return NS_VolumeStateStr(mState); }
|
const char* StateStr() const { return NS_VolumeStateStr(mState); }
|
||||||
|
|
|
@ -129,7 +129,7 @@ NS_IMETHODIMP nsVolumeService::BroadcastVolume(const nsAString& aVolName)
|
||||||
nsCOMPtr<nsIObserverService> obs = GetObserverService();
|
nsCOMPtr<nsIObserverService> obs = GetObserverService();
|
||||||
NS_ENSURE_TRUE(obs, NS_NOINTERFACE);
|
NS_ENSURE_TRUE(obs, NS_NOINTERFACE);
|
||||||
|
|
||||||
DBG("nsVolumeService::BroadcastVolume for '%s'", vol->NameStr());
|
DBG("nsVolumeService::BroadcastVolume for '%s'", vol->NameStr().get());
|
||||||
nsString stateStr(NS_ConvertUTF8toUTF16(vol->StateStr()));
|
nsString stateStr(NS_ConvertUTF8toUTF16(vol->StateStr()));
|
||||||
obs->NotifyObservers(vol, NS_VOLUME_STATE_CHANGED, stateStr.get());
|
obs->NotifyObservers(vol, NS_VOLUME_STATE_CHANGED, stateStr.get());
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -291,8 +291,8 @@ public:
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
DBG("UpdateVolumeRunnable::Run '%s' state %s gen %d locked %d",
|
DBG("UpdateVolumeRunnable::Run '%s' state %s gen %d locked %d",
|
||||||
mVolume->NameStr(), mVolume->StateStr(), mVolume->MountGeneration(),
|
mVolume->NameStr().get(), mVolume->StateStr(),
|
||||||
(int)mVolume->IsMountLocked());
|
mVolume->MountGeneration(), (int)mVolume->IsMountLocked());
|
||||||
|
|
||||||
mVolumeService->UpdateVolume(mVolume);
|
mVolumeService->UpdateVolume(mVolume);
|
||||||
mVolumeService = NULL;
|
mVolumeService = NULL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче