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
This commit is contained in:
parent
84324eb936
commit
9268c3251f
|
@ -69,13 +69,18 @@ namespace Nuclex.Support.Collections {
|
||||||
if(disposeItems) {
|
if(disposeItems) {
|
||||||
|
|
||||||
// Have the items do their cleanup work
|
// Have the items do their cleanup work
|
||||||
Reparent(default(ParentType));
|
//Reparent(default(ParentType));
|
||||||
|
|
||||||
// Dispose of all the items in the collection that implement IDisposable
|
// Dispose of all the items in the collection that implement IDisposable
|
||||||
foreach(ItemType item in this) {
|
foreach(ItemType item in this) {
|
||||||
IDisposable disposable = item as IDisposable;
|
IDisposable disposable = item as IDisposable;
|
||||||
|
|
||||||
|
// If the item is disposable, we get rid of it
|
||||||
if(disposable != null)
|
if(disposable != null)
|
||||||
disposable.Dispose();
|
disposable.Dispose();
|
||||||
|
/*else
|
||||||
|
Reparent(default(ParentType));*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user