From 9a2907a8a10b5f5fdf6cfd0ec104d57f1ce7cbbb Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Sun, 26 Jan 2014 09:09:14 +0200 Subject: [PATCH] fix AbstractObjectFactory's singleton dispose order * using stable collection and reversing it before traversal * also remove .gitattributes --- .gitattributes | 22 ------------------- .../Factory/Support/AbstractObjectFactory.cs | 4 +++- 2 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 412eeda7..00000000 --- a/.gitattributes +++ /dev/null @@ -1,22 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp -*.sln merge=union -*.csproj merge=union -*.vbproj merge=union -*.fsproj merge=union -*.dbproj merge=union - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs index ce98aff3..1b990cc9 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs @@ -2466,7 +2466,9 @@ namespace Spring.Objects.Factory.Support { // copy the keys into a new set, 'cos we are going to modifying the // original collection (_singletonCache) as we destroy each singleton. - ISet keys = new HashedSet(singletonCache.Keys); + // we also want to traverse the keys in reverse order to destroy correctly + ArrayList keys = new ArrayList(singletonCache.Keys); + keys.Reverse(); foreach (string name in keys) { DestroySingleton(name);