# Buggy code
def set_adapter(self, adapter=None):
    self.clear()
    if self.discovering:
        self.stop_discovery()
        self.emit("adapter-property-changed", self.Adapter, ("Discovering", False))

    adapter = adapter_path_to_name(adapter)

    logging.debug(adapter)

    # The pattern may be incorrect (ie removed adapter), see #590
    try:
        self.Adapter = self.manager.get_adapter(adapter)
    except bluez.errors.DBusNoSuchAdapterError:
        logging.info("Adapter pattern not valid, trying default adapter.")

    try:
        self.Adapter = self.manager.get_adapter()
        self.__adapter_path = self.Adapter.get_object_path()
    except bluez.errors.DBusNoSuchAdapterError as e:
        logging.exception(e)
        self.Adapter = None
        self.__adapter_path = None
    finally:
        self.emit("adapter-changed", None)


# Traceback (TypeError)
$ blueman-manager
blueman-manager version 2.1 starting
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/blueman/gui/manager/ManagerDeviceList.py", line 212, in on_finished
super().device_remove_event(device, tree_iter)
TypeError: super(type, obj): obj must be an instance or subtype of type
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/blueman/gui/manager/ManagerDeviceList.py", line 212, in on_finished
super().device_remove_event(device, tree_iter)
TypeError: super(type, obj): obj must be an instance or subtype of type
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/blueman/gui/manager/ManagerDeviceList.py", line 212, in on_finished
super().device_remove_event(device, tree_iter)
TypeError: super(type, obj): obj must be an instance or subtype of type
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/blueman/gui/manager/ManagerDeviceList.py", line 212, in on_finished
super().device_remove_event(device, tree_iter)
TypeError: super(type, obj): obj must be an instance or subtype of type
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/blueman/gui/manager/ManagerDeviceList.py", line 212, in on_finished
super().device_remove_event(device, tree_iter)
TypeError: super(type, obj): obj must be an instance or subtype of type

# Fixed code
def set_adapter(self, adapter=None):
    self.clear()
    if self.discovering:
        self.stop_discovery()
        self.emit("adapter-property-changed", self.Adapter, ("Discovering", False))

    adapter = adapter_path_to_name(adapter)

    logging.debug("Setting adapter to: %s " % adapter)

    if adapter is not None:
        try:
            self.Adapter = self.manager.get_adapter(adapter)
            self.__adapter_path = self.Adapter.get_object_path()
            self.emit("adapter-changed", self.__adapter_path)
        except bluez.errors.DBusNoSuchAdapterError:
            logging.warning("Failed to set adapter, trying first available.")
            self.set_adapter(None)
            return
    else:
        adapters = self.manager.get_adapters()
        if len(adapters) > 0:
            self.Adapter = adapters[0]
            self.__adapter_path = self.Adapter.get_object_path()
        else:
            self.Adapter = None
            self.__adapter_path = None

    self.emit("adapter-changed", self.__adapter_path)