Replaced RefCounted with RefCounter

This commit is contained in:
Simon Lübeß
2021-10-13 09:52:12 +02:00
parent 2cd9ab3e69
commit 84daee95e4
18 changed files with 60 additions and 25 deletions
+5 -4
View File
@@ -1,20 +1,21 @@
using System;
using DirectX.Common;
using GlitchyEngine.Core;
namespace GlitchyEngine
{
static
{
/// Releases the reference to destination, writes newValue into it and adds a reference to newValue.
public static mixin SetReference<T>(T destination, T newValue) where T: RefCounted
public static mixin SetReference<T>(T destination, T newValue) where T: RefCounter
{
destination?.ReleaseRef();
var oldDest = destination;
destination = newValue;
destination?.AddRef();
oldDest?.ReleaseRef();
}
/// Releases the reference to value and nullifies it.
public static mixin ReleaseRefAndNullify<T>(T value) where T: RefCounted
public static mixin ReleaseRefAndNullify<T>(T value) where T: RefCounter
{
value?.ReleaseRef();
value = null;