mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 755190 - Enabling b2g bluetooth will lead to system crash, r=qDot
This commit is contained in:
parent
88f9d706a6
commit
801de3662e
@ -104,16 +104,16 @@ class ToggleBtTask : public nsRunnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return 1 if it's enabled, 0 if it's disabled, and -1 on error
|
// return 1 if it's enabled, 0 if it's disabled, and -1 on error
|
||||||
int isEnabled = sBluedroidFunctions.bt_is_enabled();
|
int isEnabled = IsBluetoothEnabled();
|
||||||
|
|
||||||
if ((isEnabled == 1 && mEnabled) || (isEnabled == 0 && !mEnabled)) {
|
if ((isEnabled == 1 && mEnabled) || (isEnabled == 0 && !mEnabled)) {
|
||||||
result = true;
|
result = true;
|
||||||
} else if (isEnabled < 0) {
|
} else if (isEnabled < 0) {
|
||||||
result = false;
|
result = false;
|
||||||
} else if (mEnabled) {
|
} else if (mEnabled) {
|
||||||
result = (sBluedroidFunctions.bt_enable() == 0) ? true : false;
|
result = (EnableBluetooth() == 0) ? true : false;
|
||||||
} else {
|
} else {
|
||||||
result = (sBluedroidFunctions.bt_disable() == 0) ? true : false;
|
result = (DisableBluetooth() == 0) ? true : false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -14,6 +14,21 @@ namespace mozilla {
|
|||||||
namespace dom {
|
namespace dom {
|
||||||
namespace bluetooth {
|
namespace bluetooth {
|
||||||
|
|
||||||
|
static struct BluedroidFunctions {
|
||||||
|
bool initialized;
|
||||||
|
bool tried_initialization;
|
||||||
|
|
||||||
|
BluedroidFunctions() :
|
||||||
|
initialized(false),
|
||||||
|
tried_initialization(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int (* bt_enable)();
|
||||||
|
int (* bt_disable)();
|
||||||
|
int (* bt_is_enabled)();
|
||||||
|
} sBluedroidFunctions;
|
||||||
|
|
||||||
bool EnsureBluetoothInit() {
|
bool EnsureBluetoothInit() {
|
||||||
if (sBluedroidFunctions.tried_initialization)
|
if (sBluedroidFunctions.tried_initialization)
|
||||||
{
|
{
|
||||||
@ -49,6 +64,22 @@ bool EnsureBluetoothInit() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int IsBluetoothEnabled()
|
||||||
|
{
|
||||||
|
return sBluedroidFunctions.bt_is_enabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
int EnableBluetooth()
|
||||||
|
{
|
||||||
|
return sBluedroidFunctions.bt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
int DisableBluetooth()
|
||||||
|
{
|
||||||
|
return sBluedroidFunctions.bt_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,22 +11,11 @@ namespace mozilla {
|
|||||||
namespace dom {
|
namespace dom {
|
||||||
namespace bluetooth {
|
namespace bluetooth {
|
||||||
|
|
||||||
static struct BluedroidFunctions {
|
|
||||||
bool initialized;
|
|
||||||
bool tried_initialization;
|
|
||||||
|
|
||||||
BluedroidFunctions() :
|
|
||||||
initialized(false),
|
|
||||||
tried_initialization(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int (* bt_enable)();
|
|
||||||
int (* bt_disable)();
|
|
||||||
int (* bt_is_enabled)();
|
|
||||||
} sBluedroidFunctions;
|
|
||||||
|
|
||||||
bool EnsureBluetoothInit();
|
bool EnsureBluetoothInit();
|
||||||
|
int IsBluetoothEnabled();
|
||||||
|
int EnableBluetooth();
|
||||||
|
int DisableBluetooth();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user