Bug 835408 - nsVolume NameStr and MountPointStr noe return nsCString rather than ptr to freed memory. r=jlebar

This commit is contained in:
Dave Hylands 2013-01-28 14:34:30 -08:00
Родитель c3979e5b53
Коммит e69de7d4fa
3 изменённых файлов: 7 добавлений и 7 удалений

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

@ -101,12 +101,12 @@ nsVolume::LogState() const
{
if (mState == nsIVolume::STATE_MOUNTED) {
LOG("nsVolume: %s state %s @ '%s' gen %d locked %d",
NameStr(), StateStr(), MountPointStr(),
NameStr().get(), StateStr(), MountPointStr().get(),
MountGeneration(), (int)IsMountLocked());
return;
}
LOG("nsVolume: %s state %s", NameStr(), StateStr());
LOG("nsVolume: %s state %s", NameStr().get(), StateStr());
}
void nsVolume::Set(const nsVolume* aVolume)

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

@ -60,13 +60,13 @@ public:
void LogState() const;
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; }
bool IsMountLocked() const { return mMountLocked; }
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; }
const char* StateStr() const { return NS_VolumeStateStr(mState); }

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

@ -129,7 +129,7 @@ NS_IMETHODIMP nsVolumeService::BroadcastVolume(const nsAString& aVolName)
nsCOMPtr<nsIObserverService> obs = GetObserverService();
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()));
obs->NotifyObservers(vol, NS_VOLUME_STATE_CHANGED, stateStr.get());
return NS_OK;
@ -291,8 +291,8 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
DBG("UpdateVolumeRunnable::Run '%s' state %s gen %d locked %d",
mVolume->NameStr(), mVolume->StateStr(), mVolume->MountGeneration(),
(int)mVolume->IsMountLocked());
mVolume->NameStr().get(), mVolume->StateStr(),
mVolume->MountGeneration(), (int)mVolume->IsMountLocked());
mVolumeService->UpdateVolume(mVolume);
mVolumeService = NULL;