From bc802e63a8866ed8bc6af24c92ce7a117cc4f30a Mon Sep 17 00:00:00 2001 From: Jeffrey Barrus Date: Wed, 16 Nov 2011 12:44:07 -0700 Subject: [PATCH 1/2] fix for bugs 66, 67 related to teardown problems -tear down not removing swiz creation event listener -tear down setting up prototype beans --- src/org/swizframework/core/BeanFactory.as | 3 +++ src/org/swizframework/core/Swiz.as | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/org/swizframework/core/BeanFactory.as b/src/org/swizframework/core/BeanFactory.as index e048ed49..72fe5a22 100644 --- a/src/org/swizframework/core/BeanFactory.as +++ b/src/org/swizframework/core/BeanFactory.as @@ -253,6 +253,9 @@ package org.swizframework.core if( beans.indexOf( bean ) > -1 ) beans.splice( beans.indexOf( bean ), 1 ); + if( !( bean is Prototype ) || Prototype( bean ).initialized ) + tearDownBean( bean ); + tearDownBean( bean ); bean.beanFactory = null; bean.typeDescriptor = null; diff --git a/src/org/swizframework/core/Swiz.as b/src/org/swizframework/core/Swiz.as index 15476e1f..b8c5ac6a 100644 --- a/src/org/swizframework/core/Swiz.as +++ b/src/org/swizframework/core/Swiz.as @@ -349,6 +349,8 @@ package org.swizframework.core // tear down beans defined in bean providers or added with BeanEvents beanFactory.tearDown(); + dispatcher.removeEventListener( SwizEvent.CREATED, handleSwizCreatedEvent ); + // clear out refs parentSwiz = null; SwizManager.removeSwiz( this ); From b7c1c542e1d26893ce05d3fb1956b9cb31754a82 Mon Sep 17 00:00:00 2001 From: Jeffrey Barrus Date: Mon, 19 Mar 2012 16:51:20 -0600 Subject: [PATCH 2/2] typo - last bug fix forgot to delete the original line --- src/org/swizframework/core/BeanFactory.as | 1 - 1 file changed, 1 deletion(-) diff --git a/src/org/swizframework/core/BeanFactory.as b/src/org/swizframework/core/BeanFactory.as index 72fe5a22..e5c04fc8 100644 --- a/src/org/swizframework/core/BeanFactory.as +++ b/src/org/swizframework/core/BeanFactory.as @@ -256,7 +256,6 @@ package org.swizframework.core if( !( bean is Prototype ) || Prototype( bean ).initialized ) tearDownBean( bean ); - tearDownBean( bean ); bean.beanFactory = null; bean.typeDescriptor = null; bean.source = null;