Set parameters to null in public COM APIs

このコミットが含まれているのは:
Sergio Pedri committed 2023-02-24 00:08:14 +01:00
1 親 fb16181de3
コミット ca35f249f7
1ファイル変更
+8 -9
+8 -9
ファイルの表示
@@ -29,6 +29,10 @@ unsafe partial class PixelShaderEffect<T>
return E.E_POINTER;
}
// Set parameters to default values
*device = null;
*type = WIN2D_GET_DEVICE_ASSOCIATION_TYPE_UNSPECIFIED;
using ReferenceTracker.Lease _0 = GetReferenceTracker().TryGetLease(out bool leaseTaken);
// Check for disposal
@@ -78,12 +82,15 @@ unsafe partial class PixelShaderEffect<T>
float* realizeDpi,
ID2D1Image** ppImage)
{
// No input pointer can be null
// The device and resulting image pointers cannot be null
if (device is null || ppImage is null)
{
return E.E_POINTER;
}
// Set the resulting image to null
*ppImage = null;
using ReferenceTracker.Lease _0 = GetReferenceTracker().TryGetLease(out bool leaseTaken);
// Check for disposal
@@ -148,8 +155,6 @@ unsafe partial class PixelShaderEffect<T>
{
if (!Realize(flags, targetDpi, deviceContext))
{
*ppImage = null;
return E.E_FAIL;
}
}
@@ -170,12 +175,6 @@ unsafe partial class PixelShaderEffect<T>
return S.S_OK;
}
}
catch (Exception e)
{
*ppImage = null;
return e.HResult;
}
finally
{
// Ensure that reset this flag so that this method can be called again