Last Comment Bug 755190 - Enabling b2g bluetooth will lead to system crash
: Enabling b2g bluetooth will lead to system crash
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]
: Andrew Overholt [:overholt]
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:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

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

Description User image 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 User image 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 User image Kyle Machulis [: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 User image Eric Chou [:ericchou] [:echou] 2012-05-15 02:22:09 PDT
Thanks, Kyle. 
Then please help to check it in tomorrow morning. :)
Comment 5 User image Ed Morley [:emorley] 2012-05-16 03:36:43 PDT
Please can you set the target milestone when landing on inbound. Thank you :-)

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