Bug 1180993 - Part 3: Correct use sites of functions which return already_AddRefed. r=ehsan

This commit is contained in:
Michael Layzell 2015-07-10 08:36:00 -04:00
parent 1a947e7297
commit c1d10743ff
5 changed files with 8 additions and 6 deletions

View File

@ -10,6 +10,7 @@
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/unused.h"
#include "gfxUtils.h"
#include "nsNetUtil.h"
@ -206,7 +207,7 @@ public:
rv = NS_DispatchToMainThread(mEncodingCompleteEvent);
if (NS_FAILED(rv)) {
// Better to leak than to crash.
mEncodingCompleteEvent.forget();
unused << mEncodingCompleteEvent.forget();
return rv;
}

View File

@ -225,7 +225,7 @@ private:
// Intentionally leak the runnable (but not the fd) rather
// than crash when trying to release a main thread object
// off the main thread.
mTabParent.forget();
mozilla::unused << mTabParent.forget();
CloseFile();
}
}

View File

@ -423,8 +423,7 @@ nsReverseStringSQLFunction::OnFunctionCall(
rv = outVar->SetAsAUTF8String(result);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = outVar.get();
outVar.forget();
outVar.forget(aResult);
return NS_OK;
}

View File

@ -21,6 +21,7 @@
#include "mozilla/AutoRestore.h"
#include <algorithm>
#include "mozilla/Telemetry.h"
#include "mozilla/unused.h"
#define kMinUnwrittenChanges 300
@ -3045,7 +3046,7 @@ CacheIndex::FinishUpdate(bool aSucceeded)
NS_WARNING(("CacheIndex::FinishUpdate() - Leaking mDirEnumerator!"));
// This can happen only in case dispatching event to IO thread failed in
// CacheIndex::PreShutdown().
mDirEnumerator.forget(); // Leak it since dir enumerator is not threadsafe
unused << mDirEnumerator.forget(); // Leak it since dir enumerator is not threadsafe
} else {
mDirEnumerator->Close();
mDirEnumerator = nullptr;

View File

@ -24,6 +24,7 @@
#include "nsDirectoryServiceDefs.h"
#include "mozilla/FileUtils.h"
#include "mozilla/Services.h"
#include "mozilla/unused.h"
#include "nsIStringBundle.h"
#include "nsIXULAppInfo.h"
#include "nsContentUtils.h"
@ -80,7 +81,7 @@ struct ScopedCanberraFile {
}
void forget() {
mFile.forget();
mozilla::unused << mFile.forget();
}
nsIFile* operator->() { return mFile; }
operator nsIFile*() { return mFile; }