Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7569791CA for ; Fri, 6 Apr 2012 19:33:49 +0000 (UTC) Received: (qmail 62917 invoked by uid 500); 6 Apr 2012 19:33:49 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 62894 invoked by uid 500); 6 Apr 2012 19:33:49 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 62886 invoked by uid 99); 6 Apr 2012 19:33:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2012 19:33:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2012 19:33:45 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6F16135C67B for ; Fri, 6 Apr 2012 19:33:23 +0000 (UTC) Date: Fri, 6 Apr 2012 19:33:23 +0000 (UTC) From: "Shazron Abdullah (Resolved) (JIRA)" To: callback-dev@incubator.apache.org Message-ID: <58313986.25173.1333740804726.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <993451404.26276.1332891269981.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (CB-401) Crash on iOS when taking multiple pictures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Shazron Abdullah resolved CB-401. --------------------------------- Resolution: Duplicate This is incorrect. Autoreleasing it there is correct. Let me explain. self.pickerController = [[[CameraPicker alloc] init] autorelease]; After this, the retain count is 1. If you removed the autorelease, the retain count is 2, which is incorrect, and the Static Analyzer will back me up on this. The property is a retain property. You would be correct if we are dealing with naked ivars, but these are synthesized properties that are retained - @synthesize is just syntactic sugar, this is how it works internally: http://stackoverflow.com/questions/5350563/what-equivalent-code-is-synthesized-for-a-declared-property Also, if it's nil, setting it to nil again will not send the release message on it again, so it's safe (again, a retained synthesized property thing, see above link). The actual problem has been found in CB-391. Closing as a dupe of CB-391. > Crash on iOS when taking multiple pictures > ------------------------------------------ > > Key: CB-401 > URL: https://issues.apache.org/jira/browse/CB-401 > Project: Apache Callback > Issue Type: Bug > Components: iOS > Affects Versions: 1.4.0 > Environment: 1.4.1, 1.5.0 on iOS > Crash on iPad (third generation) > Reporter: Marc Rhodes > Assignee: Shazron Abdullah > Priority: Critical > > We have an app that allows the user to take four pictures. It had been working fine but we started seeing crashes when we tested on a new iPad (third generation). > We have eliminated the crash in our application by making the following change to the PhongeGap/Cordova code. I tested with PhoneGap 1.4.1. I'm currently upgrading to Cordova 1.5.0 but a review of {{Camera.m}}/{{CDVCamera.m}} shows only the name changes. > Line numbers below correspond to {{CDVCamera.m}}. > In {{CDVCamera.m}}, we found the following code around line 67: > {code} > if (self.pickerController == nil) > { > self.pickerController = [[[CameraPicker alloc] init] autorelease]; > } > {code} > We removed the autorelease message: > {code} > if (self.pickerController == nil) > { > self.pickerController = [[CameraPicker alloc] init]; > } > {code} > Our reason for doing this is that we found that {{self.pickerController}} appears to be released in all the right places: > * at line 220 in {{imagePickerController:didFinishPickingMediaWithInfo:}} > {code} > self.pickerController = nil; > {code} > * at line 251 in {{imagePickerControllerDidCancel:}} > {code} > self.pickerController = nil; > {code} > * at line 399 in {{dealloc}}: > {code} > self.pickerController = nil; > {code} > This last one may not always be necessary but should be okay since the previous releases set the instance variable to {{nil}}. And, of course, since pickerController is a property, setting it to {{nil}} serves to release it. > I think both autoreleasing and explicitly releasing an object is not following the memory management rules. Apple says: > * [https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html] > * Memory Management Policy > ** Basic Memory Management Rules > *** You relinquish ownership of an object by sending it a release message or an autorelease message. > My thought (confirmed with an instructor at [Big Nerd Ranch|http://www.bignerdranch.com/]) is that "or" is the key word in this statement and removing the extra autorelease could certainly prevent zombie crashes that only occur in certain circumstances. > This issue seems like a duplicate of [CB-264|https://issues.apache.org/jira/browse/CB-264] but since that one is resolved as "won't fix," I have submitted this new issue containing a possible solution. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira