Skip to content

android: release the comma decoder when discovery is cancelled - #287

Open
ehoeve786 wants to merge 1 commit into
softwiredtech:mainfrom
ehoeve786:fix/comma-discovery-leak
Open

ehoeve786 wants to merge 1 commit into
softwiredtech:mainfrom
ehoeve786:fix/comma-discovery-leak

Conversation

@ehoeve786

Copy link
Copy Markdown
Collaborator

CommaDataSource allocates a native context and VehicleDecoder (parsing the whole DBC) when constructed, before the publisher-discovery loop, but _dataSource is only assigned after discovery, so teardownConnection() never saw it. Cancelling (or a failed) discovery leaked both, on every cancelled attempt and foreground re-run. Disconnect it if discovery throws.

Testing

  • Android builds and the unit tests pass.
  • Not run on a device: this path needs a comma device on the same network, which my setup doesn't have connected.

🤖 Generated with Claude Code

CommaDataSource allocates a native context and VehicleDecoder (parsing the
whole DBC) when constructed, before the publisher-discovery loop, but
_dataSource is only assigned after discovery, so teardownConnection() never
saw it. Cancelling (or a failed) discovery leaked both, on every cancelled
attempt and foreground re-run. Disconnect it if discovery throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant