mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
Fix some camera-related crashes on 3.71 that we may need to also put out a back-ported fix for
git-svn-id: https://zxing.googlecode.com/svn/trunk@2036 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
11f83b37e1
commit
505b14de04
|
@ -252,13 +252,18 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (handler != null) {
|
||||
handler.quitSynchronously();
|
||||
handler = null;
|
||||
}
|
||||
inactivityTimer.onPause();
|
||||
cameraManager.closeDriver();
|
||||
if (!hasSurface) {
|
||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
|
||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||
surfaceHolder.removeCallback(this);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -73,13 +73,15 @@ final class DecodeHandler extends Handler {
|
|||
long start = System.currentTimeMillis();
|
||||
Result rawResult = null;
|
||||
PlanarYUVLuminanceSource source = activity.getCameraManager().buildLuminanceSource(data, width, height);
|
||||
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||
try {
|
||||
rawResult = multiFormatReader.decodeWithState(bitmap);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
} finally {
|
||||
multiFormatReader.reset();
|
||||
if (source != null) {
|
||||
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||
try {
|
||||
rawResult = multiFormatReader.decodeWithState(bitmap);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
} finally {
|
||||
multiFormatReader.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Handler handler = activity.getHandler();
|
||||
|
|
|
@ -300,7 +300,7 @@ public final class CameraManager {
|
|||
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
|
||||
Rect rect = getFramingRectInPreview();
|
||||
if (rect == null) {
|
||||
throw new IllegalStateException();
|
||||
return null;
|
||||
}
|
||||
int previewFormat = configManager.getPreviewFormat();
|
||||
String previewFormatString = configManager.getPreviewFormatString();
|
||||
|
|
Loading…
Reference in a new issue