Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A1F171831A for ; Wed, 18 Nov 2015 00:44:11 +0000 (UTC) Received: (qmail 12596 invoked by uid 500); 18 Nov 2015 00:44:11 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 12547 invoked by uid 500); 18 Nov 2015 00:44:11 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 12388 invoked by uid 99); 18 Nov 2015 00:44:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Nov 2015 00:44:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 2FE812C1F6E for ; Wed, 18 Nov 2015 00:44:11 +0000 (UTC) Date: Wed, 18 Nov 2015 00:44:11 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-8863) Fix potential problems with blocks usage in core plugins 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-8863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15009939#comment-15009939 ] ASF GitHub Bot commented on CB-8863: ------------------------------------ GitHub user purplecabbage opened a pull request: https://github.com/apache/cordova-plugin-camera/pull/139 CB-8863 correct block usage for async calls You can merge this pull request into a Git repository by running: $ git pull https://github.com/purplecabbage/cordova-plugin-camera CB-8863 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-camera/pull/139.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 #139 ---- commit 7f3a0a5483322a76e9121bda18f36ec84566aeab Author: Jesse MacFadyen Date: 2015-11-18T00:37:45Z CB-8863 correct block usage for async calls ---- > Fix potential problems with blocks usage in core plugins > -------------------------------------------------------- > > Key: CB-8863 > URL: https://issues.apache.org/jira/browse/CB-8863 > Project: Apache Cordova > Issue Type: Bug > Components: iOS > Reporter: Shazron Abdullah > Assignee: Jesse MacFadyen > Labels: cordova-ios-5.0.x > > Audit the core plugins to check for proper blocks usage. > Problems that I see can be summed up in this (fixed) code: > https://github.com/apache/cordova-plugin-splashscreen/blob/fa60f01adcba2d21583de7972a0facc4da1eb75e/src/ios/CDVSplashScreen.m#L292-L313 > 1. You need a weak reference to "self" in blocks to prevent retain cycle problems. > Fix: https://github.com/apache/cordova-plugin-splashscreen/blob/fa60f01adcba2d21583de7972a0facc4da1eb75e/src/ios/CDVSplashScreen.m#L292 > 2. Anything that calls UIKit methods, which includes plugins that write JavaScript back to the UIWebView (commandDelegate functions), must be called in the main thread. > Fix: https://github.com/apache/cordova-plugin-splashscreen/blob/fa60f01adcba2d21583de7972a0facc4da1eb75e/src/ios/CDVSplashScreen.m#L308-L310 (UPDATE: we actually already handle this in evalJS) > 3. Avoid creating private variables like this in the first place -- I would create a class extension which will effectively have "private" properties (nothing is truly private in objc). This is to avoid this situation in the block where you have to cast the weak self into a strong self (and check it's still around), just to access a private variable: > https://github.com/apache/cordova-plugin-splashscreen/blob/fa60f01adcba2d21583de7972a0facc4da1eb75e/src/ios/CDVSplashScreen.m#L298-L304 > Of course since we are modifying UIKit items here, rule 2 above also applies. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org