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

[geolocator_apple] Crash if listen/cancel is executed in quick succession #1612

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mkurz-it
Copy link

@mkurz-it mkurz-it commented Nov 27, 2024

The onDidAuthorizationChanged is executed by iOS somewhen afer CLLocationManager is created in onListenWithArguments.

If the the subscription is canceled in the meantime _eventSink (onCancelWithArguments) is set to nil leading to accessing _eventSink when already nil (BAD_ACCESS crash).

Pre-launch Checklist

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

…sion

The onDidAuthorizationChanged is executed by iOS somewhen afer CLLocationManager is created in onListenWithArguments.

If the the subscription is canceled in the meantime _eventSink (onCancelWithArguments) is set to nil leading to accessing _eventSink when already nil (BAD_ACCESS crash).
@mkurz-it mkurz-it force-pushed the bug/MRS-2850/mk/crash-event-sink-nil branch from fadb33e to 5692781 Compare November 27, 2024 12:40
@mkurz-it mkurz-it changed the title MRS-2850 Crash if listen/cancel is executed in quick succession [geolocator_apple] Crash if listen/cancel is executed in quick succession Nov 27, 2024
@TimHoogstrate
Copy link
Contributor

Dear @mkurz-it,

Thanks for your contribution. Is there an issue related to this PR? I tried to reproduce this in "main" but I could not make it crash (although I can see that it potentially could crash from code :)).

Kind regards

@mkurz-it
Copy link
Author

Hi @TimHoogstrate

Thanks for taking your time.

... Is there an issue related to this PR? I tried to reproduce this in "main" but I could not make it crash (although I can see that it potentially could crash from code :)).

There is no open issue. We are using your package in our APP and it crashed.
When analyzing the problem the fixed code was the cause.

FYI: It did not crash on every startup (so every 5-10 starts).
It will crash if you cancel the subscription quickly after subscription.
Actually before iOS called onDidAuthorizationChanged (is called asynchronously by the OS).

Best regards,

Michael

@TimHoogstrate
Copy link
Contributor

Dear @mkurz-it,

It looks good, but can you "split/update" the PR in geolocator_apple and remove/revert the "geolocator" App Facing Package changes, as they are not needed. It will be updated automatically as a patch to users. If you need some help, ping us.

Kind regards,

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.

3 participants