[ 
https://issues.apache.org/jira/browse/CB-10554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15136391#comment-15136391
 ] 

ASF GitHub Bot commented on CB-10554:
-------------------------------------

GitHub user adamduren opened a pull request:

    https://github.com/apache/cordova-plugin-media-capture/pull/51

    [CB-10554] Fix null reference in low memory conditions

    [Related Jira](https://issues.apache.org/jira/browse/CB-10554)
    State is lost when the activity is not kept as a result of low memory 
conditions. This causes a NullPointerException in multiple places. Save the 
state and restore it on resume.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/adamduren/cordova-plugin-media-capture patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-media-capture/pull/51.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #51
    
----
commit 7bbec803d8aa5585a7ce2a651c34c2d5db55ba09
Author: Adam Duren <[email protected]>
Date:   2016-02-07T19:20:35Z

    Fix null reference in low memory conditions
    
    State is lost when the activity is not kept as a result of low memory 
conditions. This causes a NullPointerException in multiple places. Save the 
state and restore it on resume.

----


> Media Capture: Null reference in low memory conditions
> ------------------------------------------------------
>
>                 Key: CB-10554
>                 URL: https://issues.apache.org/jira/browse/CB-10554
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Media Capture
>         Environment: android
>            Reporter: Adam Duren
>              Labels: android
>
> I have been testing my app in low memory conditions by setting the android 
> developer setting of "Don't keep Activities" which simulates low memory 
> conditions. Every time I use the capture plugin for video when returning from 
> the capture activity the app crashes. It appears that the state is not saved 
> and on resume there are now null references such as the callbackContext and 
> results array. It is fixed by using the onRestoreStateForActivityResult and 
> onSaveInstanceState methods.
> *Related Exception* 
> {quote}
> 7 14:30:31.181 23432-24842/com.ionicframework.alto442183 E/AndroidRuntime: 
> FATAL EXCEPTION: pool-3-thread-2
>                                                                               
>  Process: com.ionicframework.alto442183, PID: 23432
>                                                                               
>  java.lang.NullPointerException: Attempt to invoke virtual method 'void 
> org.apache.cordova.CallbackContext.sendPluginResult(org.apache.cordova.PluginResult)'
>  on a null object reference
>                                                                               
>      at org.apache.cordova.mediacapture.Capture$3.run(Capture.java:396)
>                                                                               
>      at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
>                                                                               
>      at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
>                                                                               
>      at java.lang.Thread.run(Thread.java:818)
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to