Skip to content

Commit

Permalink
Merge pull request #778 from dlech/mac-fixes
Browse files Browse the repository at this point in the history
Mac fixes
  • Loading branch information
dlech authored Apr 29, 2022
2 parents 6c38e87 + 1770778 commit 9f1c515
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Fixed

* Fixed reading the battery level returns a zero-filled bytearray on BlueZ >= 5.48. Fixes #750.
* Fixed unpairing does not work on windows with winrt. Fixes #699
* Fixed leak of ``_disconnect_futures`` in ``CentralManagerDelegate``.
* Fixed callback not removed from ``_disconnect_callbacks`` on disconnect in ``CentralManagerDelegate``.


`0.14.2`_ (2022-01-26)
Expand Down
5 changes: 3 additions & 2 deletions bleak/backends/corebluetooth/CentralManagerDelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ async def disconnect(self, peripheral: CBPeripheral) -> None:
self.central_manager.cancelPeripheralConnection_(peripheral)
await future
finally:
del self._disconnect_callbacks[peripheral.identifier()]
del self._disconnect_futures[peripheral.identifier()]

@objc.python_method
def _changed_is_scanning(self, is_scanning: bool) -> None:
Expand Down Expand Up @@ -353,7 +353,8 @@ def did_disconnect_peripheral(
else:
future.set_result(None)

callback = self._disconnect_callbacks.get(peripheral.identifier())
callback = self._disconnect_callbacks.pop(peripheral.identifier(), None)

if callback is not None:
callback()

Expand Down

0 comments on commit 9f1c515

Please sign in to comment.