[gnome-bluetooth] lib: Fix Discoverable being reset when turned off



commit 6b5086d42ea64d46277f3c93b43984f331d12f89
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jul 19 14:19:58 2018 +0200

    lib: Fix Discoverable being reset when turned off
    
    Work-around race in bluetoothd which would reset the discoverable
    flag if a timeout change was requested before discoverable finished
    being set to off:
    
    See https://bugzilla.redhat.com/show_bug.cgi?id=1602985

 lib/bluetooth-client.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 6bf16dae..8c786688 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1005,10 +1005,20 @@ _bluetooth_client_set_discoverable (BluetoothClient *client,
        if (adapter == NULL)
                return FALSE;
 
-       g_object_set (adapter,
-                     "discoverable", discoverable,
-                     "discoverable-timeout", timeout,
-                     NULL);
+       if (discoverable) {
+               g_object_set (adapter,
+                             "discoverable", discoverable,
+                             "discoverable-timeout", timeout,
+                             NULL);
+       } else {
+               /* Work-around race in bluetoothd which would reset the discoverable
+                * flag if a timeout change was requested before discoverable finished
+                * being set to off:
+                * https://bugzilla.redhat.com/show_bug.cgi?id=1602985 */
+               g_object_set (adapter,
+                             "discoverable", FALSE,
+                             NULL);
+       }
        g_object_unref (adapter);
 
        return TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]