dotnet / iot

This repo includes .NET Core implementations for various IoT boards, chips, displays and PCBs.
MIT License
2.12k stars 574 forks source link

Fix access violation issue in libgpiod v1 driver #2311

Closed pgrawehr closed 2 weeks ago

pgrawehr commented 1 month ago

Fixes #1849

After the cause is finally verified, this removes the SafeHandle base class from SafeLineHandle and changes it to a normal class. The line(s) are always disposed together with their chips, and thus do not need to be explicitly disposed. Lines (individual pins) must not be disposed after the chip is disposed.

This also adds various tests to make sure exceptions are thrown when attempting to use disposed drivers.

Microsoft Reviewers: Open in CodeFlow
joperezr commented 1 month ago

/azp run dotnet.iot

azure-pipelines[bot] commented 1 month ago
Azure Pipelines successfully started running 1 pipeline(s).
pgrawehr commented 3 weeks ago

@joperezr I unfortunately have no idea why we get that report about the missing finalizer. It is there in all places.