Fixed VM disposal issues

This commit is contained in:
Robert committed 2023-05-12 23:27:27 +02:00
1 parent 5adc837673
commit e783dcaa58
8 files changed
+17 -36

No files matched your search

@@ -54,7 +54,7 @@ internal class PropertyInputService : IPropertyInputService
return existing;
}
_container.Register(viewModelType);
_container.Register(viewModelType, setup: Setup.With(preventDisposal: true));
PropertyInputRegistration registration = new(this, plugin, supportedType, viewModelType);
_registeredPropertyEditors.Add(registration);
return registration;
@@ -220,7 +220,7 @@ public abstract class PropertyInputViewModel<T> : PropertyInputViewModel
/// <summary>
/// For internal use only, implement <see cref="PropertyInputViewModel" /> instead.
/// </summary>
public abstract class PropertyInputViewModel : ReactiveValidationObject, IActivatableViewModel, IDisposable
public abstract class PropertyInputViewModel : ReactiveValidationObject, IActivatableViewModel
{
/// <summary>
/// Prevents this type being implemented directly, implement
@@ -228,29 +228,7 @@ public abstract class PropertyInputViewModel : ReactiveValidationObject, IActiva
/// </summary>
// ReSharper disable once UnusedMember.Global
internal abstract object InternalGuard { get; }
/// <summary>
/// Releases the unmanaged resources used by the object and optionally releases the managed resources.
/// </summary>
/// <param name="disposing">
/// <see langword="true" /> to release both managed and unmanaged resources;
/// <see langword="false" /> to release only unmanaged resources.
/// </param>
protected virtual void Dispose(bool disposing)
{
}
#region Implementation of IActivatableViewModel
/// <inheritdoc />
public ViewModelActivator Activator { get; } = new();
#endregion
/// <inheritdoc />
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}