Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix phantom delegate trying to use its referenced gatt instance #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smoy
Copy link

@smoy smoy commented May 13, 2015

Prior to the change, when one disconnect a connected device in Android,
Device instance inserts a delegate to GattCallback instance to cache
discovered Services. However, when one disconnects such device, the
delegate is not removed. So upon next device connection, that delegate
will attempt to reference a disposed Gatt instance and cause a crash.

To reproduce this bug, you can try the following sequence:

  1. Scan for Devices
  2. Connect to Device A
  3. Discovers Service of Device A
  4. Dsiconnect Device A
  5. Connect to Device A again
  6. Discovers Service of Device A
  7. Crash

Prior to the change, when one disconnect a connected device in Android,
Device instance inserts a delegate to GattCallback instance to cache
discovered Services. However, when one disconnects such device, the
delegate is not removed. So upon next device connection, that delegate
will attempt to reference a disposed Gatt instance and cause a crash.

To reproduce this bug, you can try the following sequence:

1) Scan for Devices
2) Connect to Device A
3) Discovers Service of Device A
4) Dsiconnect Device A
5) Connect to Device A again
6) Discovers Service of Device A
7) Crash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant