mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
Defensive change against late callbacks; not clear it's actually any issue
git-svn-id: https://zxing.googlecode.com/svn/trunk@2303 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
4f1c884797
commit
235a12ac42
|
@ -735,6 +735,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
if (surfaceHolder == null) {
|
if (surfaceHolder == null) {
|
||||||
throw new IllegalStateException("No SurfaceHolder provided");
|
throw new IllegalStateException("No SurfaceHolder provided");
|
||||||
}
|
}
|
||||||
|
if (cameraManager.isOpen()) {
|
||||||
|
Log.w(TAG, "initCamera() while already open -- late SurfaceView callback?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
cameraManager.openDriver(surfaceHolder);
|
cameraManager.openDriver(surfaceHolder);
|
||||||
// Creating the handler starts the preview, which can also throw a RuntimeException.
|
// Creating the handler starts the preview, which can also throw a RuntimeException.
|
||||||
|
|
|
@ -94,6 +94,10 @@ public final class CameraManager {
|
||||||
configManager.setDesiredCameraParameters(theCamera);
|
configManager.setDesiredCameraParameters(theCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized boolean isOpen() {
|
||||||
|
return camera != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the camera driver if still in use.
|
* Closes the camera driver if still in use.
|
||||||
*/
|
*/
|
||||||
|
@ -136,7 +140,7 @@ public final class CameraManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method for {@link com.srowen.bs.android.CaptureActivity}
|
* Convenience method for {@link com.google.zxing.client.android.CaptureActivity}
|
||||||
*/
|
*/
|
||||||
public synchronized void setTorch(boolean newSetting) {
|
public synchronized void setTorch(boolean newSetting) {
|
||||||
if (camera != null) {
|
if (camera != null) {
|
||||||
|
|
Loading…
Reference in a new issue