changeset 238:bdfdba6b645b v2

fixed unpredictable Safe.Dispose behaviour
author cin
date Fri, 01 Dec 2017 01:28:56 +0300
parents f2150c16b476
children eedf4d834e67
files Implab/Components/ServiceLocator.cs Implab/Safe.cs
diffstat 2 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Implab/Components/ServiceLocator.cs	Wed Nov 22 16:54:58 2017 +0300
+++ b/Implab/Components/ServiceLocator.cs	Fri Dec 01 01:28:56 2017 +0300
@@ -7,7 +7,7 @@
     /// </summary>
     public class ServiceLocator: Disposable, IServiceLocator, IServiceProvider {
         // запись о сервисе
-        struct ServiceEntry : IDisposable {
+        class ServiceEntry : IDisposable {
             public object service; // сервис
             public bool shared; // признак того, что сервис НЕ нужно освобождать
             public Func<object> activator; // активатор сервиса при первом обращении
--- a/Implab/Safe.cs	Wed Nov 22 16:54:58 2017 +0300
+++ b/Implab/Safe.cs	Fri Dec 01 01:28:56 2017 +0300
@@ -90,11 +90,9 @@
         }
 
         public static void Dispose(object obj) {
-            if (obj is IDisposable) {
+            if (obj is IDisposable)
                 Dispose((IDisposable)obj);
-            } else if (obj is IEnumerable) {
-                DisposeCollection((IEnumerable)obj);
-            }
+            
         }
 
         [DebuggerStepThrough]