Fix crash with custom SelectionOutline postfx object in Editor viewport

This commit is contained in:
Wojtek Figat
2022-11-08 19:52:47 +01:00
parent f2170a09cd
commit e53623e854

View File

@@ -399,8 +399,8 @@ namespace FlaxEditor.Viewport
{
if (_customSelectionOutline != null)
{
Object.Destroy(ref _customSelectionOutline);
Task.RemoveCustomPostFx(_customSelectionOutline);
Object.Destroy(ref _customSelectionOutline);
Task.AddCustomPostFx(customSelectionOutline ? customSelectionOutline : SelectionOutline);
}
else if (customSelectionOutline != null)
@@ -1157,6 +1157,13 @@ namespace FlaxEditor.Viewport
private void ReleaseResources()
{
if (Task)
{
Task.RemoveCustomPostFx(SelectionOutline);
Task.RemoveCustomPostFx(EditorPrimitives);
Task.RemoveCustomPostFx(_editorSpritesRenderer);
Task.RemoveCustomPostFx(_customSelectionOutline);
}
Object.Destroy(ref SelectionOutline);
Object.Destroy(ref EditorPrimitives);
Object.Destroy(ref _editorSpritesRenderer);