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

[camera] Add protection around DroidMediaCamera pointer in CameraListener #59

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

Conversation

peat-psuwit
Copy link
Contributor

When destroying DroidMediaCamera, CameraListener held inside an ongoing
callback can outlive the destroying instance. To prevent it from
accessing DroidMediaCamera after being destroyed, one needs to remove
the reference to DroidMediaCamera inside the listener before deleting
it.

As this removal happens in a different thread then callbacks, a mutex is
required to prevent race condition. Also, just to be safe, remove the
listener from the Android Camera instance as well.

…ener

When destroying DroidMediaCamera, CameraListener held inside an ongoing
callback can outlive the destroying instance. To prevent it from
accessing DroidMediaCamera after being destroyed, one needs to remove
the reference to DroidMediaCamera inside the listener before deleting
it.

As this removal happens in a different thread then callbacks, a mutex is
required to prevent race condition. Also, just to be safe, remove the
listener from the Android Camera instance as well.
@pvuorela
Copy link

pvuorela commented Jul 6, 2021

@mlehtima or @abranson

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.

2 participants