checkpoint
This commit is contained in:
@@ -7,13 +7,6 @@ namespace Foodsoft.Alpm
|
||||
{
|
||||
internal sealed class SafeDatabaseHandle : SafeHandle
|
||||
{
|
||||
internal SafeAlpmHandle SafeAlpmHandle
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
[PrePrepareMethod]
|
||||
get;
|
||||
} = null!;
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
[PrePrepareMethod]
|
||||
internal SafeDatabaseHandle(IntPtr dbPtr, SafeAlpmHandle safeAlpmHandle) : base(IntPtr.Zero, true)
|
||||
@@ -35,18 +28,27 @@ namespace Foodsoft.Alpm
|
||||
if (!success) throw new ObjectDisposedException(GetType().FullName);
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail), PrePrepareMethod]
|
||||
internal SafeAlpmHandle SafeAlpmHandle
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
[PrePrepareMethod]
|
||||
get;
|
||||
} = null!;
|
||||
|
||||
public override bool IsInvalid
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
[PrePrepareMethod]
|
||||
get => handle == IntPtr.Zero;
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
[PrePrepareMethod]
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
var err = alpm.alpm_db_unregister(handle);
|
||||
SafeAlpmHandle.DangerousRelease();
|
||||
return err == 0;
|
||||
}
|
||||
|
||||
public override bool IsInvalid
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success), PrePrepareMethod]
|
||||
get => handle == IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user