Bug 692961 - Capturing image on camera api crashes [@ mozalloc_abort | __swrite ] [r=blassey] [a=asa]
authorFabrice Desré <fabrice@mozilla.com>
Fri, 14 Oct 2011 09:30:51 -0700
changeset 79097 a6f988cf41113facae9a46cf9a874c70136de46a
parent 79096 b2f3b19ebe42b7e287b26ddd1220dbc989efd19a
child 79098 c9155f2b618f531720bc8cfbd37cd6174f3dc258
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, asa
bugs692961
milestone9.0a2
Bug 692961 - Capturing image on camera api crashes [@ mozalloc_abort | __swrite ] [r=blassey] [a=asa]
embedding/android/GeckoAppShell.java
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -1586,17 +1586,18 @@ public class GeckoAppShell
             }
 
             sCamera.setParameters(params);
             sCameraBuffer = new byte[(bufferSize * 12) / 8];
             sCamera.addCallbackBuffer(sCameraBuffer);
             sCamera.setPreviewCallbackWithBuffer(new android.hardware.Camera.PreviewCallback() {
                 public void onPreviewFrame(byte[] data, android.hardware.Camera camera) {
                     cameraCallbackBridge(data);
-                    sCamera.addCallbackBuffer(sCameraBuffer);
+                    if (sCamera != null)
+                        sCamera.addCallbackBuffer(sCameraBuffer);
                 }
             });
             sCamera.startPreview();
             params = sCamera.getParameters();
             Log.i("GeckoAppJava", "Camera: " + params.getPreviewSize().width + "x" + params.getPreviewSize().height +
                   " @ " + params.getPreviewFrameRate() + "fps. format is " + params.getPreviewFormat());
             result[0] = 1;
             result[1] = params.getPreviewSize().width;