Closed Bug 976032 Opened 6 years ago Closed 6 years ago

Camera Application Crash if focus mode is set to continuous-picture in re factored code

Categories

(Firefox OS Graveyard :: Gaia::Camera, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
1.4 S2 (28feb)

People

(Reporter: srinivasvemula.mtech, Assigned: mikeh)

References

Details

(Keywords: crash)

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36

Steps to reproduce:

 Set the focus mode  "Continuous-picture"  in Camera.prototype.configure = function(mozCamera) method in Camera.js .


Actual results:

Camera application got crashed in 2 or 3 seconds after preview started. 


Expected results:

Camera preview should start properly with continuous-picture focus mode.
Keywords: crash
Unable to reproduce with:
- gecko: b2g-inbound:4b6103d24d1e
- gaia: master:e5cb62e63b3c2fbe326c96f712e36d228cc765ad
Mike,
When focus mode is set to continuous-picture,notifcation message is coming from Camera to 
void GonkCameraHardware::notify(int32_t aMsgType, int32_t ext1, int32_t ext2) method. Here OnAutofocusComplete method getting called.
I think the issue with nsDOMCameraControl::OnAutoFocusComplete(bool aAutoFocusSucceeded) method.There is no checking condition of CameraAutoFocusCallback is null or not null.
Attached patch CameraAppCrash (obsolete) — Splinter Review
Comment on attachment 8381143 [details] [diff] [review]
CameraAppCrash

>diff -Nru b/dom/camera/DOMCameraControl.cpp a/dom/camera/DOMCameraControl.cpp
>--- b/dom/camera/DOMCameraControl.cpp	2014-02-24 09:03:23.000000000 +0530
>+++ a/dom/camera/DOMCameraControl.cpp	2014-02-25 10:03:57.878240220 +0530
>@@ -1293,7 +1293,10 @@
> 
>   nsCOMPtr<CameraAutoFocusCallback> cb = mAutoFocusOnSuccessCb.forget();
>   mAutoFocusOnErrorCb = nullptr;
>+ // Checking the Callback stops the application to get crash if callback is null.  
>+ if(cb){
>   cb->Call(aAutoFocusSucceeded, ignored);
>+  }
> }
> 
> void
Attachment #8381143 - Attachment description: This patch checks the autofocus call back is null or not before callback is done and this check condition stops the camera application crash in case callback is null → CameraAppCrash
(In reply to Srinivas Vemula from comment #2)
>
> When focus mode is set to continuous-picture, notifcation message is coming
> from Camera to 
> void GonkCameraHardware::notify(int32_t aMsgType, int32_t ext1, int32_t
> ext2) method. Here OnAutofocusComplete method getting called.

That's interesting--I was under the impression that there was no callback in continuous autofocus mode, at least not until JB/KK.
Assignee: nobody → mhabicher
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment on attachment 8381491 [details] [diff] [review]
WIP - Guard against null callbacks, v1

I'm not sure how Srinivas was hitting this condition, but this guard definitely won't hurt.
Attachment #8381491 - Flags: review?(dhylands)
Comment on attachment 8381491 [details] [diff] [review]
WIP - Guard against null callbacks, v1

Review of attachment 8381491 [details] [diff] [review]:
-----------------------------------------------------------------

Looks reasonable to me.
Attachment #8381491 - Flags: review?(dhylands) → review+
https://hg.mozilla.org/mozilla-central/rev/9ce9bdf1ffe7
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4 S2 (28feb)
Duplicate of this bug: 976915
You need to log in before you can comment on or make changes to this bug.