Guard volume event node UI during editor teardown#1198
Conversation
Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/35465f2b-a4e7-4071-b0e1-12c07ddd6896 Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com>
|
@copilot Would you be able to provide reproduction steps for the original issue? What do we have to do in order to get the original error before the fix was applied? Also, please double-check that the changes don't cause any regressions for other places in the code. |
On
For regressions, I re-checked the only affected paths: normal node editing still uses the same code path because the new guards only return when the node, editor, form, or control is already null/disposed, and the deferred |
Closing the VolumeBox event editor with a volume still selected could leave the visual scripting UI in a transient teardown state. In that window, saving the project could sporadically trigger a
NullReferenceExceptionfromVisibleNodeBase.SpawnUIElements().Root cause
SelectedIndexChangedand deferredBeginInvokerefreshes.Lifecycle hardening
VisibleNodeBase.SpawnUIElements()when the node, editor, or control is already disposing/detached.FindForm().CreateGraphics()unconditionally; DPI lookup now only runs when the form still exists.Event safety
cbFunction_SelectedIndexChanged()before mutating node state.TriggerManagerrefresh callbacks from running after the control has started tearing down.Scope