Bug 1050494: Clear sBluetoothThread in BluetoothDBusService on shutdown to fix memory leak. r=shuang

This commit is contained in:
Jocelyn Liu 2014-08-08 16:22:32 +08:00
parent 92a362d3ac
commit de0443c58f
2 changed files with 4 additions and 0 deletions

View File

@ -37,6 +37,7 @@
#include "nsDataHashtable.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Atomics.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/Hal.h"
#include "mozilla/ipc/UnixSocket.h"
@ -373,6 +374,7 @@ DispatchToBtThread(nsIRunnable* aRunnable)
sBluetoothThread = new LazyIdleThread(BT_LAZY_THREAD_TIMEOUT_MS,
NS_LITERAL_CSTRING("BluetoothDBusService"),
LazyIdleThread::ManualShutdown);
ClearOnShutdown(&sBluetoothThread);
}
return sBluetoothThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
}

View File

@ -37,6 +37,7 @@
#include "nsDataHashtable.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Atomics.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/Hal.h"
#include "mozilla/ipc/UnixSocket.h"
@ -370,6 +371,7 @@ DispatchToBtThread(nsIRunnable* aRunnable)
sBluetoothThread = new LazyIdleThread(BT_LAZY_THREAD_TIMEOUT_MS,
NS_LITERAL_CSTRING("BluetoothDBusService"),
LazyIdleThread::ManualShutdown);
ClearOnShutdown(&sBluetoothThread);
}
return sBluetoothThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
}