diff --git a/SerialPort/SerialConnection.cs b/SerialPort/SerialConnection.cs index 05cafdb..affbce5 100644 --- a/SerialPort/SerialConnection.cs +++ b/SerialPort/SerialConnection.cs @@ -563,8 +563,6 @@ public ITerminalConnection EstablishConnection(IPoderosaMainWindow window, ITerm internal class SerialPortUtil { public static SerialTerminalConnection CreateNewSerialConnection(IPoderosaMainWindow window, SerialTerminalParam param, SerialTerminalSettings settings) { - bool successful = false; - FileStream strm = null; try { StringResource sr = SerialPortPlugin.Instance.Strings; //Debug.WriteLine("OPENING COM"+param.Port); @@ -598,7 +596,6 @@ public static SerialTerminalConnection CreateNewSerialConnection(IPoderosaMainWi timeouts.WriteTotalTimeoutConstant = 100; timeouts.WriteTotalTimeoutMultiplier = 100; Win32Serial.SetCommTimeouts(ptr, ref timeouts); - successful = true; SerialTerminalConnection r = new SerialTerminalConnection(param, settings, ptr); return r; } @@ -610,10 +607,6 @@ public static SerialTerminalConnection CreateNewSerialConnection(IPoderosaMainWi GUtil.Warning(Form.ActiveForm, ex.Message); //TODO 苦しい逃げ。IPoderosaFormを実装したベースクラスをCoreにでも持っていたほうがいいのか return null; } - finally { - if (!successful && strm != null) - strm.Close(); - } } public static bool FillDCB(IntPtr handle, ref Win32Serial.DCB dcb) { dcb.DCBlength = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(Win32Serial.DCB)); //sizeofくらいunsafeでなくても使わせてくれよ