Fix issue with updating props quickly causing released camera object to be accessed. (#507)
This commit is contained in:
parent
536d39b33b
commit
f696610115
|
@ -49,9 +49,11 @@ public class RCTCamera {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseCameraInstance(int type) {
|
public void releaseCameraInstance(int type) {
|
||||||
if (null != _cameras.get(type)) {
|
// Release seems async and creates race conditions. Remove from map first before releasing.
|
||||||
_cameras.get(type).release();
|
Camera releasingCamera = _cameras.get(type);
|
||||||
|
if (null != releasingCamera) {
|
||||||
_cameras.remove(type);
|
_cameras.remove(type);
|
||||||
|
releasingCamera.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue