mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
fix: remove ComPortController finalizer and harden deactivate cleanup
This commit is contained in:
parent
cffcfbbda1
commit
1681d4e796
1 changed files with 1 additions and 11 deletions
|
|
@ -114,17 +114,6 @@ namespace PepperDash.Essentials.Core
|
||||||
Port.SerialDataReceived += Port_SerialDataReceived;
|
Port.SerialDataReceived += Port_SerialDataReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Destructor
|
|
||||||
/// </summary>
|
|
||||||
~ComPortController()
|
|
||||||
{
|
|
||||||
if (Port == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Port.SerialDataReceived -= Port_SerialDataReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
|
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
|
||||||
{
|
{
|
||||||
OnDataReceived(args.SerialData);
|
OnDataReceived(args.SerialData);
|
||||||
|
|
@ -162,6 +151,7 @@ namespace PepperDash.Essentials.Core
|
||||||
if (Port == null)
|
if (Port == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Port.SerialDataReceived -= Port_SerialDataReceived;
|
||||||
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue