From 80414ffe1788a8b9de18e38734544173db902015 Mon Sep 17 00:00:00 2001 From: fcolin Date: Sun, 18 Mar 2012 17:29:48 +0000 Subject: Dispose rules detected by VS2011 --- Ivy/Ivy.cs | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'Ivy/Ivy.cs') diff --git a/Ivy/Ivy.cs b/Ivy/Ivy.cs index 0b1818a..9344ca9 100644 --- a/Ivy/Ivy.cs +++ b/Ivy/Ivy.cs @@ -27,7 +27,7 @@ namespace IvyBus /// The Main bus Class /// /// - public class Ivy + public class Ivy : IDisposable { /* Event */ /// @@ -1410,5 +1410,31 @@ namespace IvyBus return valid; } - } + + #region IDisposable Membres + // needed by tcplistener_running + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // Free other state (managed objects). + if (tcplistener_running != null) + { + tcplistener_running.Close(); + tcplistener_running = null; + } + } + // Free your own state (unmanaged objects). + // Set large fields to null. + + } + + #endregion + } } \ No newline at end of file -- cgit v1.1