Bug 985949 - Correctly forget pointer references in Bluedroid backend. r=echou, a=1.4+
authorThomas Zimmermann <tdz@users.sourceforge.net>
Mon, 24 Mar 2014 10:44:29 +0100
changeset 192338 8aad11bd420113366084b36145ae87e2976a48c2
parent 192337 67a1b14ec3750708e9481b359f7e33b0dfbe0554
child 192339 39ba48e7ce21b67ecb63031437317a9ddd22ac61
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou, 1
bugs985949, 967364
milestone30.0a2
Bug 985949 - Correctly forget pointer references in Bluedroid backend. r=echou, a=1.4+ This patch fixes a regression from bug 967364. An nsRefPtr is now correctly cleared by |forget| without causing a crash.
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
@@ -26,16 +26,17 @@
 #include "BluetoothProfileController.h"
 #include "BluetoothReplyRunnable.h"
 #include "BluetoothUtils.h"
 #include "BluetoothUuid.h"
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 #include "mozilla/ipc/UnixSocket.h"
 #include "mozilla/StaticMutex.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/unused.h"
 
 using namespace mozilla;
 using namespace mozilla::ipc;
 USING_BLUETOOTH_NAMESPACE
 
 /**
  *  Static variables
  */
@@ -796,17 +797,17 @@ BluetoothServiceBluedroid::GetDefaultAda
 
   v.get_ArrayOfBluetoothNamedValue().AppendElement(
     BluetoothNamedValue(NS_LITERAL_STRING("Devices"),
                         sAdapterBondedAddressArray));
 
   nsAutoString replyError;
   DispatchBluetoothReply(runnable.get(), v, replyError);
 
-  runnable.forget();
+  unused << runnable.forget(); // picked up in DispatchBluetoothReply
 
   return NS_OK;
 }
 
 nsresult
 BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal(
   uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable)
 {