[Mono.Debugger.Soft] Don't make Connection disposable.
authorJeffrey Stedfast <jeff@xamarin.com>
Thu, 3 May 2012 22:01:30 +0000 (18:01 -0400)
committerJeffrey Stedfast <jeff@xamarin.com>
Thu, 3 May 2012 22:08:43 +0000 (18:08 -0400)
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs

index 70bfb86a4ee2f33555fcf51e1188593016ded1a7..1c9e4f58bbb90fbfd8df67b35bc1301b81778484 100644 (file)
@@ -353,7 +353,7 @@ namespace Mono.Debugger.Soft
        /*
         * Represents the connection to the debuggee
         */
-       public abstract class Connection : IDisposable
+       public abstract class Connection
        {
                /*
                 * The protocol and the packet format is based on JDWP, the differences 
@@ -1132,7 +1132,9 @@ namespace Mono.Debugger.Soft
                                        if (!res)
                                                break;
                                } catch (Exception ex) {
-                                       Console.WriteLine (ex);
+                                       if (!closed) {
+                                               Console.WriteLine (ex);
+                                       }
                                        break;
                                }
                        }
@@ -2214,20 +2216,10 @@ namespace Mono.Debugger.Soft
                        res.domain_id = r.ReadId ();
                        return res;
                }
-               
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-               
-               protected virtual void Dispose (bool disposing)
-               {
-               }
-               
-               ~Connection ()
+
+               public void ForceDisconnect ()
                {
-                       Dispose (false);
+                       TransportClose ();
                }
        }
        
@@ -2267,15 +2259,6 @@ namespace Mono.Debugger.Soft
                {
                        socket.Close ();
                }
-               
-               protected override void Dispose (bool disposing)
-               {
-                       if (disposing) {
-                               //Socket.Dispose is explicit in < .NET 4.0
-                               ((IDisposable)socket).Dispose ();
-                       }
-                       base.Dispose (disposing);
-               }
        }
 
        /* This is the interface exposed by the debugger towards the debugger agent */
index 440e1c82f05fa37ba6aac7ecefc1242597042773..c1693e683f3d203cfe8153f92610f2843299e46d 100644 (file)
@@ -134,13 +134,17 @@ namespace Mono.Debugger.Soft
                        conn.VM_Exit (exitCode);
                }
 
-               public void Dispose () {
+               public void Detach () {
                        conn.VM_Dispose ();
                        conn.Close ();
-                       conn.Dispose ();
                        notify_vm_event (EventType.VMDisconnect, SuspendPolicy.None, 0, 0, null);
                }
 
+               public void ForceDisconnect ()
+               {
+                       conn.ForceDisconnect ();
+               }
+
                public IList<ThreadMirror> GetThreads () {
                        long[] ids = vm.conn.VM_GetThreads ();
                        ThreadMirror[] res = new ThreadMirror [ids.Length];