Skip to content

daemon: Don't disconnect from a null object

ivan tkachenko requested to merge work/ratijas/dangling-disconnect into master

Regardless whether a Bluetooth device with a battery was disconnected from within an operating system (e.g. by clicking Disconnect button in the applet) or externally (such as falling asleep on its own, or flipping a physical switch OFF), whenever the Solid::DeviceNotifier::deviceRemoved signal is emitted, the corresponding Solid::Device's backend object has already been destroyed; so that Core::onDeviceRemoved handler attempted to disconnect from a null pointer which produces a warning.

Given that right before emitting the deviceRemoved() signal, the setBackendObject(nullptr) is called which literally deletes the device's backend object, there is no need to disconnect.

BUG: 487647

Merge request reports