Closed Meythulhu closed 1 month ago
Looks like it may be a regression from https://github.com/godotengine/godot/pull/88014 cc @Geometror
It seems connections_layer
is null when this Callable is called:
Well, I'm surprised it took so long until we see the non-internal connection layer causing problems ;)
It looks like you remove all children including the connection layer at some point (haven't checked the addon code). To fix this crash you need to check whether each node you remove is a GraphElement
. The connections layer has to be kept non-internal for now because internal nodes at arbitrary indices (not just front or back) are currently not possible and it has to be drawn between frames and graph nodes.
I'm going to open a PR which adds a warning when you accidentally remove the connection layer as well as checks everywhere a crash could occur (not ideal, but at least it's safe).
It looks like you remove all children including the connection layer at some point (haven't checked the addon code). To fix this crash you need to check whether each node you remove is a
GraphElement
. The connections layer has to be kept non-internal for now because internal nodes at arbitrary indices (not just front or back) are currently not possible and it has to be drawn between frames and graph nodes.
Yep! It seems to be caused by DialogueGraph.ClearTree()
, which just calls GetChildren()
and frees all children. Adding a filter for any node named _connection_layer
seems to prevent it from being removed.
This seems like an issue that can be easily ran into; Is it possible for _connection_layer
to be made internal to prevent it from being treated as a non-internal node?
Unfortunately not, as I said:
The connections layer has to be kept non-internal for now because internal nodes at arbitrary indices (not just front or back) are currently not possible and it has to be drawn between frames and graph nodes.
The best we can do is warn the user about it and prevent the crash, hence https://github.com/godotengine/godot/pull/96309
Tested versions
System information
Windows 11 - v4.3.stable.mono.official.77dcf97d8 - Vulkan 1.3.278 - Forward+ - NVIDIA GeForce RTX 4060 Ti
Issue description
Through the process of using the
Dialogue Trees
plugin, I noticed that an exception is thrown whenever trying to edit a DialogueTree node. The exception thrown is a AccessViolationException, which shortly crashes Godot 4.3 with no further information other than the stack trace.It seems to occur when trying to add or remove a
GraphNode
from theDialogueGraph
class (which extendsGraphEdit
). I tried passing brand newGraphNode
, I tried deferring the calls, and I tried removing the optional parameters, as well as playing with the values of the differentAddChild
parameters. All of these seem to have no effect on the exception occurring and a crash following after.It's also important to note that this does not occur on
DialogueTree
nodes which are recently added to the scene, only ones loaded from the file system. This is only impacting theDialogueGraph
added to the dock; theDialogueTree
node functions properly when running in-game.I tried running memory dumps and attaching the godot process to a debugger, and there is no breakpoint hit or any sort of trace in the memory dump outside of the AccessViolationException being thrown only in the managed assembly. It just silently closes Godot with exit code 139 (SIGSEGV signal - Memory Access Violation).
Steps to reproduce
With the Minimal Reproduction Project:
TestScene.tscn
in the Godot EditorWithout the Minimal Reproduction Project:
Dialogue Trees - C#
from the Asset LibraryMinimal reproduction project (MRP)
DialogueTest.zip