Bug 1050003 - Remove unnecessary if checks before delete-ing in xpcom/. r=froydnj

This commit is contained in:
Birunthan Mohanathas 2014-08-08 07:04:45 -07:00
parent 3e8abfd2e8
commit c70ab152cb
5 changed files with 25 additions and 43 deletions

View File

@ -466,25 +466,17 @@ Shutdown()
RecordBatch::DeleteLog();
if (gMonitor) {
delete gMonitor;
gMonitor = nullptr;
}
delete gMonitor;
gMonitor = nullptr;
if (gEventFilter) {
delete gEventFilter;
gEventFilter = nullptr;
}
delete gEventFilter;
gEventFilter = nullptr;
if (gProfilerStart) {
delete gProfilerStart;
gProfilerStart = nullptr;
}
delete gProfilerStart;
gProfilerStart = nullptr;
if (gMaxBacklogTime) {
delete gMaxBacklogTime;
gMaxBacklogTime = nullptr;
}
delete gMaxBacklogTime;
gMaxBacklogTime = nullptr;
#endif
}

View File

@ -974,31 +974,27 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
NS_IF_RELEASE(gDebug);
if (sIOThread) {
delete sIOThread;
sIOThread = nullptr;
}
if (sMessageLoop) {
delete sMessageLoop;
sMessageLoop = nullptr;
}
delete sIOThread;
sIOThread = nullptr;
delete sMessageLoop;
sMessageLoop = nullptr;
if (sCommandLineWasInitialized) {
CommandLine::Terminate();
sCommandLineWasInitialized = false;
}
if (sExitManager) {
delete sExitManager;
sExitManager = nullptr;
}
delete sExitManager;
sExitManager = nullptr;
Omnijar::CleanUp();
HangMonitor::Shutdown();
if (sMainHangMonitor) {
delete sMainHangMonitor;
sMainHangMonitor = nullptr;
}
delete sMainHangMonitor;
sMainHangMonitor = nullptr;
BackgroundHangMonitor::Shutdown();
#ifdef MOZ_VISUAL_EVENT_TRACER

View File

@ -83,9 +83,7 @@ protected:
virtual ~BaseStringEnumerator()
{
if (mArray) {
delete[] mArray;
}
delete [] mArray;
}
void Sort();

View File

@ -400,10 +400,8 @@ nsNativeCharsetConverter::GlobalInit()
void
nsNativeCharsetConverter::GlobalShutdown()
{
if (gLock) {
delete gLock;
gLock = nullptr;
}
delete gLock;
gLock = nullptr;
if (gNativeToUnicode != INVALID_ICONV_T) {
iconv_close(gNativeToUnicode);

View File

@ -122,10 +122,8 @@ public:
}
~AutoCreateAndDestroyReentrantMonitor() {
if (*mReentrantMonitorPtr) {
delete *mReentrantMonitorPtr;
*mReentrantMonitorPtr = nullptr;
}
delete *mReentrantMonitorPtr;
*mReentrantMonitorPtr = nullptr;
}
private: