Last Comment Bug 755190 - Enabling b2g bluetooth will lead to system crash
: Enabling b2g bluetooth will lead to system crash
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Device Interfaces (show other bugs)
: unspecified
: All Gonk (Firefox OS)
: -- normal (vote)
: mozilla15
Assigned To: Eric Chou [:ericchou] [:echou]
:
Mentors:
Depends on:
Blocks: b2g-bluetooth
  Show dependency treegraph
 
Reported: 2012-05-14 23:13 PDT by Eric Chou [:ericchou] [:echou]
Modified: 2012-05-16 03:36 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
v1: Fix crash while enabling Bluetooth (3.70 KB, patch)
2012-05-15 00:19 PDT, Eric Chou [:ericchou] [:echou]
kyle: review+
Details | Diff | Review

Description Eric Chou [:ericchou] [:echou] 2012-05-14 23:13:04 PDT
Currently if you try to enable Bluetooth, B2G process will restart. The root cause is both BluetoothAdapter.cpp and BluetoothFirmware.cpp includes BluetoothFirmware.h, and that makes static struct object sBluedroidFunctions have individual object in each file. Therefore, it will crash while calling the method of sBluedroidFunctions:

  int isEnabled = sBluedroidFunctions.bt_is_enabled();
  // sBluedroidFunctions here belongs to BluetoothAdapter,
  // not to BluetoothFirmware.
Comment 1 Eric Chou [:ericchou] [:echou] 2012-05-15 00:19:18 PDT
Created attachment 623956 [details] [diff] [review]
v1: Fix crash while enabling Bluetooth
Comment 2 Kyle Machulis [:kmachulis] [:qdot] 2012-05-15 02:18:14 PDT
Comment on attachment 623956 [details] [diff] [review]
v1: Fix crash while enabling Bluetooth

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

r=me with nits I caused picked by someone else. :D 

I'll land it in the morning (or at least, my morning) unless you want to mark it with "needs landing"

::: dom/bluetooth/BluetoothFirmware.h
@@ +10,5 @@
>  namespace mozilla {
>  namespace dom {
>  namespace bluetooth {
>  
> +bool EnsureBluetoothInit();

nit that's really my fault: Not that the struct before it had any, but we could probably use some comments here to say when/where Ensure should be called (main thread, before dbus functions are called, etc...)
Comment 3 Eric Chou [:ericchou] [:echou] 2012-05-15 02:22:09 PDT
Thanks, Kyle. 
Then please help to check it in tomorrow morning. :)
Comment 4 Kyle Machulis [:kmachulis] [:qdot] 2012-05-15 12:47:51 PDT
http://hg.mozilla.org/integration/mozilla-inbound/rev/bff01f1a1daf
Comment 5 Ed Morley [:emorley] 2012-05-16 03:36:43 PDT
Please can you set the target milestone when landing on inbound. Thank you :-)

https://hg.mozilla.org/mozilla-central/rev/bff01f1a1daf

Note You need to log in before you can comment on or make changes to this bug.