Fix issue with updating props quickly causing released camera object to be accessed. (#507)

This commit is contained in:
pkwak-sf 2016-12-10 07:15:52 -06:00 committed by Nicolas Charpentier
parent 536d39b33b
commit f696610115
1 changed files with 4 additions and 2 deletions

View File

@ -49,9 +49,11 @@ public class RCTCamera {
}
public void releaseCameraInstance(int type) {
if (null != _cameras.get(type)) {
_cameras.get(type).release();
// Release seems async and creates race conditions. Remove from map first before releasing.
Camera releasingCamera = _cameras.get(type);
if (null != releasingCamera) {
_cameras.remove(type);
releasingCamera.release();
}
}