From 9268c3251f1a6ce3eaa4a349035cf9f94ef98d40 Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Thu, 10 May 2007 19:11:28 +0000 Subject: [PATCH] Removed reparent call from ParentingCollection.Dispose() method. If a class deriving from ParentingCollection wants to disconnect all its items in order to prevent collection elements from accessing their owner (which might have been disposed already), it can still Reparent() the collection to null manually git-svn-id: file:///srv/devel/repo-conversion/nusu@17 d2e56fa2-650e-0410-a79f-9358c0239efd --- Source/Collections/ParentingCollection.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Collections/ParentingCollection.cs b/Source/Collections/ParentingCollection.cs index 4d5e866..840defd 100644 --- a/Source/Collections/ParentingCollection.cs +++ b/Source/Collections/ParentingCollection.cs @@ -69,13 +69,18 @@ namespace Nuclex.Support.Collections { if(disposeItems) { // Have the items do their cleanup work - Reparent(default(ParentType)); + //Reparent(default(ParentType)); // Dispose of all the items in the collection that implement IDisposable foreach(ItemType item in this) { IDisposable disposable = item as IDisposable; + + // If the item is disposable, we get rid of it if(disposable != null) disposable.Dispose(); + /*else + Reparent(default(ParentType));*/ + } }