Fix crash due to alive reference to old asset validator

#3081
This commit is contained in:
Wojtek Figat
2024-12-10 17:01:41 +01:00
parent 4f281b4732
commit 139a431614
4 changed files with 17 additions and 2 deletions

View File

@@ -1,7 +1,6 @@
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;
using System.IO;
using FlaxEditor.Scripting;
using FlaxEngine;
using FlaxEngine.Utilities;

View File

@@ -292,5 +292,17 @@ namespace FlaxEditor.CustomEditors.Editors
_isRefreshing = false;
}
}
/// <inheritdoc />
protected override void Deinitialize()
{
if (_validator != null)
{
_validator.OnDestroy();
_validator = null;
}
base.Deinitialize();
}
}
}

View File

@@ -898,9 +898,13 @@ namespace FlaxEditor.CustomEditors.Editors
base.Draw();
}
/// <inheritdoc />
public override void OnDestroy()
{
_pickerValidator.OnDestroy();
_pickerValidator = null;
base.OnDestroy();
}
private bool ValidateActors(ActorNode node)

View File

@@ -59,7 +59,7 @@ namespace FlaxEditor.GUI
/// <summary>
/// Initializes a new instance of the <see cref="AssetPicker"/> class.
/// </summary>
/// <param name="assetType">The assets types that this picker accepts.</param>
/// <param name="assetType">The asset types that this picker accepts.</param>
/// <param name="location">The control location.</param>
public AssetPicker(ScriptType assetType, Float2 location)
: base(location, new Float2(DefaultIconSize + ButtonsOffset + ButtonsSize, DefaultIconSize))