mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 818696 - prevent "pairing failed" prompt from appearing after re-enabling Bluetooth, r=gyeh
This commit is contained in:
parent
4413b8708c
commit
4fcb9b5e02
@ -151,6 +151,7 @@ static const char* sBluetoothDBusSignals[] =
|
||||
static nsAutoPtr<RawDBusConnection> gThreadConnection;
|
||||
static nsDataHashtable<nsStringHashKey, DBusMessage* > sPairingReqTable;
|
||||
static nsDataHashtable<nsStringHashKey, DBusMessage* > sAuthorizeReqTable;
|
||||
static bool sIsPairing = false;
|
||||
typedef void (*UnpackFunc)(DBusMessage*, DBusError*, BluetoothValue&, nsAString&);
|
||||
|
||||
class DistributeBluetoothSignalTask : public nsRunnable {
|
||||
@ -819,8 +820,12 @@ RunDBusCallback(DBusMessage* aMsg, void* aBluetoothReplyRunnable,
|
||||
void
|
||||
GetObjectPathCallback(DBusMessage* aMsg, void* aBluetoothReplyRunnable)
|
||||
{
|
||||
RunDBusCallback(aMsg, aBluetoothReplyRunnable,
|
||||
UnpackObjectPathMessage);
|
||||
if (sIsPairing) {
|
||||
RunDBusCallback(aMsg, aBluetoothReplyRunnable,
|
||||
UnpackObjectPathMessage);
|
||||
|
||||
sIsPairing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -1566,6 +1571,8 @@ BluetoothDBusService::StopInternal()
|
||||
sAuthorizeReqTable.EnumerateRead(UnrefDBusMessages, nullptr);
|
||||
sAuthorizeReqTable.Clear();
|
||||
|
||||
sIsPairing = false;
|
||||
|
||||
StopDBus();
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2087,6 +2094,21 @@ BluetoothDBusService::CreatePairedDeviceInternal(const nsAString& aAdapterPath,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* FIXME: Bug 820274
|
||||
*
|
||||
* If the user turns off Bluetooth in the middle of pairing process, the
|
||||
* callback function GetObjectPathCallback (see the third argument of the
|
||||
* function call above) may still be called while enabling next time by
|
||||
* dbus daemon. To prevent this from happening, added a flag to distinguish
|
||||
* if Bluetooth has been turned off. Nevertheless, we need a check if there
|
||||
* is a better solution.
|
||||
*
|
||||
* Please see Bug 818696 for more information.
|
||||
*/
|
||||
sIsPairing = true;
|
||||
|
||||
runnable.forget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user