From e53623e854e617dcbaeee396790639a41bed89e8 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 8 Nov 2022 19:52:47 +0100 Subject: [PATCH] Fix crash with custom SelectionOutline postfx object in Editor viewport --- Source/Editor/Viewport/MainEditorGizmoViewport.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Viewport/MainEditorGizmoViewport.cs b/Source/Editor/Viewport/MainEditorGizmoViewport.cs index a79ef1e17..da07eb422 100644 --- a/Source/Editor/Viewport/MainEditorGizmoViewport.cs +++ b/Source/Editor/Viewport/MainEditorGizmoViewport.cs @@ -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);