After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 790801 - Device removal fixes
Device removal fixes
Status: RESOLVED FIXED
Product: gnome-bluetooth
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-bluetooth-general-maint@gnome.bugs
gnome-bluetooth-general-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2017-11-24 18:58 UTC by Bastien Nocera
Modified: 2017-11-26 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
lib: Remove "interface-removed" callback (1.82 KB, patch)
2017-11-24 18:58 UTC, Bastien Nocera
reviewed Details | Review
lib: Fix removing devices not removing them from the UI (2.03 KB, patch)
2017-11-24 18:58 UTC, Bastien Nocera
reviewed Details | Review
lib: Export a way to get the default adapter proxy internally (1.34 KB, patch)
2017-11-24 18:59 UTC, Bastien Nocera
committed Details | Review
lib: Simplify removing a device (1.52 KB, patch)
2017-11-24 18:59 UTC, Bastien Nocera
committed Details | Review
lib: Fix removal of device and adapters (1.20 KB, patch)
2017-11-24 21:55 UTC, Benjamin Berg
committed Details | Review

Description Bastien Nocera 2017-11-24 18:58:34 UTC
.
Comment 1 Bastien Nocera 2017-11-24 18:58:51 UTC
Created attachment 364351 [details] [review]
lib: Remove "interface-removed" callback

By the time we receive this signal, the interface we might be using to
monitor the device type is probably gone, meaning that we can't say what
it used to be. We need to be watching for the object being removed
instead.
Comment 2 Bastien Nocera 2017-11-24 18:58:57 UTC
Created attachment 364352 [details] [review]
lib: Fix removing devices not removing them from the UI

As mentioned in the previous commit, watching for removed
interfaces and checking whether an object is of a certain type will not
help us because the object would have lost its identifying interface by
the time we get to it.

Instead, when an object is removed, look at the proxy we have saved for
its path, and remove the appropriate type of object (adapter or device)
from our tree.
Comment 3 Bastien Nocera 2017-11-24 18:59:02 UTC
Created attachment 364353 [details] [review]
lib: Export a way to get the default adapter proxy internally

So that the Settings widget can use it.
Comment 4 Bastien Nocera 2017-11-24 18:59:07 UTC
Created attachment 364354 [details] [review]
lib: Simplify removing a device

We don't need to create a proxy ourselves, BluetoothClient can hand us
one.
Comment 5 Benjamin Berg 2017-11-24 21:34:38 UTC
Review of attachment 364351 [details] [review]:

Basically that means assuming that the Adapter1/Device1 interface will be added/removed with the object itself. That assumption seems to be true as we are not interested in any of the dynamic interfaces (e.g. org.bluez.MediaControl1).

So fine with me to add the patch.
Comment 6 Benjamin Berg 2017-11-24 21:51:16 UTC
Review of attachment 364351 [details] [review]:

Actually, let me suggest another fix. The interfaces are there and it works correctly in principle, the check is just wrong.
Comment 7 Benjamin Berg 2017-11-24 21:51:34 UTC
Review of attachment 364352 [details] [review]:

See earlier patch.
Comment 8 Benjamin Berg 2017-11-24 21:52:03 UTC
Review of attachment 364353 [details] [review]:

Looks good.
Comment 9 Benjamin Berg 2017-11-24 21:54:34 UTC
Review of attachment 364354 [details] [review]:

Nice
Comment 10 Benjamin Berg 2017-11-24 21:55:03 UTC
Created attachment 364362 [details] [review]
lib: Fix removal of device and adapters

The interface_add routine was checking for the interfaces in the wrong
way. This means that no interface removal worked and devices would not
disappear from the list.
Comment 11 Bastien Nocera 2017-11-26 16:16:44 UTC
Attachment 364353 [details] pushed as 456a0e7 - lib: Export a way to get the default adapter proxy internally
Attachment 364354 [details] pushed as cb52c8f - lib: Simplify removing a device
Attachment 364362 [details] pushed as f5af59e - lib: Fix removal of device and adapters