diff options
author | Carlos Alberto Cortez <calberto.cortez@gmail.com> | 2006-04-05 11:22:04 +0400 |
---|---|---|
committer | Carlos Alberto Cortez <calberto.cortez@gmail.com> | 2006-04-05 11:22:04 +0400 |
commit | 905eb264b8d14d34cce67a88f9d4e8dbfa20eccb (patch) | |
tree | bd0858af375405e4ee741342405e071e854cceae /mcs/class/System/System.IO.Ports/SerialPort.cs | |
parent | f9183555d4cea352e257e00da895923ce37df605 (diff) |
2006-04-05 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* SerialPort.cs: Add protected Dispose method, and move
the Close stuff there.
svn path=/trunk/mcs/; revision=59051
Diffstat (limited to 'mcs/class/System/System.IO.Ports/SerialPort.cs')
-rw-r--r-- | mcs/class/System/System.IO.Ports/SerialPort.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mcs/class/System/System.IO.Ports/SerialPort.cs b/mcs/class/System/System.IO.Ports/SerialPort.cs index f57eb9215e1..6a809b721d8 100644 --- a/mcs/class/System/System.IO.Ports/SerialPort.cs +++ b/mcs/class/System/System.IO.Ports/SerialPort.cs @@ -375,11 +375,16 @@ namespace System.IO.Ports public void Close () { - isOpen = false; + Dispose (false); + } - if (stream != null) - stream.Close (); + protected override void Dispose (bool disposing) + { + if (!isOpen) + return; + isOpen = false; + stream.Close (); stream = null; } |