Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D669C200BCC for ; Mon, 14 Nov 2016 17:26:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D4B33160B0D; Mon, 14 Nov 2016 16:26:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 32223160B06 for ; Mon, 14 Nov 2016 17:26:00 +0100 (CET) Received: (qmail 1343 invoked by uid 500); 14 Nov 2016 16:25:59 -0000 Mailing-List: contact issues-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list issues@flex.apache.org Received: (qmail 1327 invoked by uid 99); 14 Nov 2016 16:25:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Nov 2016 16:25:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 3C9322C2B10 for ; Mon, 14 Nov 2016 16:25:59 +0000 (UTC) Date: Mon, 14 Nov 2016 16:25:59 +0000 (UTC) From: "Josh Tynjala (JIRA)" To: issues@flex.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (FLEX-34913) Types passed by reference should not be stored on the prototype because they are shared by all instances MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 14 Nov 2016 16:26:01 -0000 [ https://issues.apache.org/jira/browse/FLEX-34913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Josh Tynjala closed FLEX-34913. ------------------------------- > Types passed by reference should not be stored on the prototype because they are shared by all instances > -------------------------------------------------------------------------------------------------------- > > Key: FLEX-34913 > URL: https://issues.apache.org/jira/browse/FLEX-34913 > Project: Apache Flex > Issue Type: Bug > Components: FalconJX > Affects Versions: Apache FalconJX 0.5.0 > Reporter: Josh Tynjala > Assignee: Alex Harui > Fix For: Apache FalconJX 0.5.0 > > > Try the following ActionScript: > class Example > { > public var prop:Object = {}; > } > var obj:Example = new Example(); > obj.prop.value = 5; > var obj2:Example = new Example(); > trace(obj2.prop.value); //5 > The emitter puts the prop member on the prototype, so it is shared by all instances of Example: > Example.prototype.prop = {}; > Instead, the emitter should set the property in Example's constructor so that each instance has a separate object. Maybe something like this: > public function Example() > { > this.prop = {}; > super(); > } > There is a workaround. A developer can manually set the property in the constructor, basically using the same code as above: > class Example > { > public function Example() > { > this.prop = {}; > } > public var prop:Object; > } -- This message was sent by Atlassian JIRA (v6.3.4#6332)