Core - Corrected disposable pattern usage

Core - Further nullable refactoring..
This commit is contained in:
Robert committed 2020-11-17 20:54:49 +01:00
1 parent 27e25f22ed
commit b185b28645
38 files changed
+429 -162

No files matched your search

+6 -6
View File
@@ -140,7 +140,7 @@ namespace Artemis.Core.Modules
internal DataModel? InternalDataModel { get; set; }
internal bool InternalExpandsMainDataModel { get; set; }
internal ModuleSettingsEntity? Entity { get; set; }
internal ModuleSettingsEntity? SettingsEntity { get; set; }
/// <summary>
/// Called each frame when the module should update
@@ -233,12 +233,12 @@ namespace Artemis.Core.Modules
internal void ApplyToEntity()
{
if (Entity == null)
Entity = new ModuleSettingsEntity();
if (SettingsEntity == null)
SettingsEntity = new ModuleSettingsEntity();
Entity.ModuleId = Id;
Entity.PriorityCategory = (int) PriorityCategory;
Entity.Priority = Priority;
SettingsEntity.ModuleId = Id;
SettingsEntity.PriorityCategory = (int) PriorityCategory;
SettingsEntity.Priority = Priority;
}
}
@@ -96,6 +96,7 @@ namespace Artemis.Core.Modules
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
/// </summary>
protected internal readonly List<PropertyInfo> HiddenPropertiesList = new List<PropertyInfo>();
private readonly object _lock = new object();
/// <summary>
/// Creates a new instance of the <see cref="ProfileModule" /> class
@@ -154,7 +155,7 @@ namespace Artemis.Core.Modules
if (IsUpdateAllowed)
Update(deltaTime);
lock (this)
lock (_lock)
{
OpacityOverride = AnimatingProfileChange
? Math.Max(0, OpacityOverride - 0.1)
@@ -172,7 +173,7 @@ namespace Artemis.Core.Modules
{
Render(deltaTime, surface, canvas, canvasInfo);
lock (this)
lock (_lock)
{
// Render the profile
ActiveProfile?.Render(canvas);
@@ -210,7 +211,7 @@ namespace Artemis.Core.Modules
if (!IsActivated)
throw new ArtemisCoreException("Cannot activate a profile on a deactivated module");
lock (this)
lock (_lock)
{
if (profile == ActiveProfile)
return;