Merge pull request #2373 from akoeplinger/servicemodel-tcpreplychannel-race
[mono.git] / mcs / class / System.Data.OracleClient / System.Data.OracleClient / OracleConnectionPool.cs
index 1602fd500ca4d3a610faf037269f4e88e26d384b..195275afd8e338bcb97660c3331925e1a7ab6b63 100644 (file)
@@ -97,21 +97,16 @@ namespace System.Data.OracleClient
                        return manager.CreateConnection (info);
                }
 
-               ~OracleConnectionPool ()
+               public void Dispose () 
                {
                        if (list != null) {
-                               if (list.Count > 0) {
-                                       for (int c = 0; c < list.Count; c++) {
-                                               // There are available connections in the pool
-                                               OciGlue connection = (OciGlue)list [c];
-                                               list.RemoveAt (c);
-                                               if (connection.Connected) {
+                               if (list.Count > 0)
+                                       foreach (OciGlue connection in list)
+                                               if (connection.Connected)
                                                        connection.Disconnect ();
-                                                       connection = null;
-                                               }
-                                       }
-                               }
-                       }
+                               list.Clear ();
+                               list = null;
+                       }                       
                }
        }
 }