Closed Bug 988111 Opened 10 years ago Closed 10 years ago

MOZ_ASSERT(aWindow) in BluetoothDevice::Create (aWindow=0x0, aValue=...) at BluetoothDevice.cpp:168

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.0 S1 (9may)

People

(Reporter: jaliu, Assigned: jaliu)

References

Details

Attachments

(1 file, 1 obsolete file)

Seen on current gaia/gecko trunk with debug gecko.

MOZ_ASSERT(aWindow) was triggered in mozilla::dom::bluetooth::BluetoothDevice::Create
It locates at ../../../dom/bluetooth/BluetoothDevice.cpp:168

STR:
0. Make sure there are several discoverable BT devices around your device.
1. Set Bluetooth enable and start to discovery through setting app.
2. Open dialer app
3. Call a number and hang up.

Reproduced Rate: 30%
Assignee: nobody → jaliu
See Also: → 980039
Root cause:
Since the BluetoothAdapter from setting app starts to discover BT devices, the BluetoothAdapter from calls_handler.js might receives few 'devicefound' events.

If adapter which is held calls_handler.js receives a 'devicefound' event after user hand up the phone call (i.e. close the call handler), the MOZ_ASSERT would be triggered.

Solution:
Unregister Bluetooth signal handler when BT objects were disconnected from owner window
I removed BindToOwner() from BluetoothManager since we already called it through initialization list of constructor.

Please refer to [1], ": nsDOMEventTargetHelper(aWindow)" would bind BluetoothManager to owner.
[1] http://dxr.mozilla.org/mozilla-central/source/dom/events/nsDOMEventTargetHelper.h#37

It did the same thing in BluetoothAdapter and BluetoothDevice.
Status: NEW → ASSIGNED
Comment on attachment 8396933 [details] [diff] [review]
Unregister Bluetooth signal handler when BT objects were disconnected from owner window. (v0)

Review of attachment 8396933 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bluetooth/BluetoothAdapter.cpp
@@ +196,5 @@
>  void
> +BluetoothAdapter::DisconnectFromOwner()
> +{
> +  nsDOMEventTargetHelper::DisconnectFromOwner();
> +

nit: blank line

::: dom/bluetooth/BluetoothManager.cpp
@@ +113,5 @@
>  void
> +BluetoothManager::DisconnectFromOwner()
> +{
> +  nsDOMEventTargetHelper::DisconnectFromOwner();
> +

nit:blank line
Attachment #8396933 - Flags: feedback?(shuang) → feedback+
Comment on attachment 8396933 [details] [diff] [review]
Unregister Bluetooth signal handler when BT objects were disconnected from owner window. (v0)

Review of attachment 8396933 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me. To be honest I don't know if this is the best solution to fix the issue, but it should work.

::: dom/bluetooth/BluetoothManager.cpp
@@ +113,5 @@
>  void
> +BluetoothManager::DisconnectFromOwner()
> +{
> +  nsDOMEventTargetHelper::DisconnectFromOwner();
> +

Actually it's ok to me to leave a blank line to separate calling the base function and other logic.
Attachment #8396933 - Flags: review?(echou) → review+
Keywords: checkin-needed
https://hg.mozilla.org/integration/b2g-inbound/rev/c8be375e0c41

I had to fix the bug number in the commit message. Please double-check that in the future when requesting checkin.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/c8be375e0c41
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.5 S1 (9may)
The following changesets are now in Firefox Nightly:

> c8be375e0c41 Bug 988111 - Unregister Bluetooth signal handler when BT objects were disconnected from owner window. r=echou, f=shuang
> 4941a2ac0786 Fix merge bustage between changeset c8be375e0c41 (bug 988111) and changeset 8560fc7e2849 (bug 984269), merged (I think) in changeset 0ff6afce0133, on a CLOSED TREE.

Nightly Build Information:

        ID: 20140402030201
 Changeset: 4941a2ac0786109b08856738019b016a6c5a66a6
   Version: 31.0a1
      TBPL: https://tbpl.mozilla.org/?rev=4941a2ac0786
       URL: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central

Download Links:

>         Linux x86: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-i686.tar.bz2
>      Linux x86_64: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-x86_64.tar.bz2
> Linux x86_64 ASAN: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-x86_64-asan.tar.bz2
>               Mac: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.mac.dmg
>             Win32: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.win32.installer.exe
>             Win64: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.win64-x86_64.installer.exe

Previous Nightly Build Information:

        ID: 20140401030203
 Changeset: 1417d180a1d8665b1a91b897d1cc4cc31e7980d4
   Version: 31.0a1
      TBPL: https://tbpl.mozilla.org/?rev=1417d180a1d8
       URL: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-01-03-02-03-mozilla-central
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: