opencvsharp
opencvsharp copied to clipboard
DisposableObject.IsDisposed is set before checking for IsEnabledDispose
Summary of your issue
DisposableObject.IsDisposed is set to true before checking for IsEnabledDispose. If IsEnabledDispose is false and Dispose is called, this results in an object appearing disposed when it isn't.
https://github.com/shimat/opencvsharp/blob/66a140b8ed0df3cff81745d3e14170c21ba9a2b7/src/OpenCvSharp/Fundamentals/DisposableObject.cs#L86-L88
Environment
OpenCvSharp 4.5.3.20210817 .NET Framework 4.7.2 Windows 10 64-bit
What did you do when you faced the problem?
Ran the test below.
Example code:
[TestMethod()]
public void MatDisposeBug()
{
var mat = new Mat<Vec4b>(15, 15);
mat.IsEnabledDispose = false;
mat.Dispose();
Assert.IsFalse(mat.IsDisposed);
}
Output:
Assert.IsFalse failed.
What did you intend to be?
The test should have succeeded.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.