Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor (4.3 beta) crashes with access violation when trying to load previously created tree in scene #6

Open
lewiji opened this issue Jun 10, 2024 · 5 comments

Comments

@lewiji
Copy link

lewiji commented Jun 10, 2024

Platform: Windows 11

Created a DialogueTree node in the editor in a scene. Added code to start the dialogue and display text. Went back to the editor after some time and switched back into the scene with the DialogueTree. The editor crashes to desktop (reliably crashes whenever I select the DialogueTree node in the scene when the project is open in the editor).

Godot Engine v4.3.beta1.mono.official.a4f2ea91a - https://godotengine.org
OpenGL API 3.3.0 - Build 31.0.101.4575 - Compatibility - Using Device: Intel - Intel(R) Iris(R) Xe Graphics

Editing project: D:/dev/dev/drpg
Godot Engine v4.3.beta1.mono.official.a4f2ea91a - https://godotengine.org
Vulkan 1.3.242 - Forward+ - Using Device #1: NVIDIA - NVIDIA T550 Laptop GPU

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Godot.NativeInterop.NativeFuncs.godotsharp_method_bind_ptrcall(IntPtr, IntPtr, Void**, Void*)
   at Godot.NativeCalls.godot_icall_3_764(IntPtr, IntPtr, IntPtr, Godot.NativeInterop.godot_bool, Int32)
   at Godot.Node.AddChild(Godot.Node, Boolean, InternalMode)
   at Ardot.DialogueTrees.DialogueGraph.<LoadTree>g__AddDialogueNode|26_0(Godot.Node, Int32, <>c__DisplayClass26_0 ByRef)
   at Ardot.DialogueTrees.DialogueGraph.LoadTree(Ardot.DialogueTrees.DialogueTreeData, Boolean, Godot.Collections.Array`1<Godot.Node>)
   at Ardot.DialogueTrees.DialogueTreeDock.LoadTree(Ardot.DialogueTrees.DialogueTree)
   at Ardot.DialogueTrees.DialogueTreesPlugin._Edit(Godot.GodotObject)
   at Godot.EditorPlugin.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name ByRef, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant ByRef)
   at Ardot.DialogueTrees.DialogueTreesPlugin.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name ByRef, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant ByRef)
   at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr, Godot.NativeInterop.godot_string_name*, Godot.NativeInterop.godot_variant**, Int32, Godot.NativeInterop.godot_variant_call_error*, Godot.NativeInterop.go)
@lewiji
Copy link
Author

lewiji commented Jun 10, 2024

Having run the plugin through the debugger while this happens - I have no idea why, it seems innocuous enough. It throws during the AddChild method when constructing the graph editor dock. But it doesn't seem to be doing anything strange or threaded. It could just be down to 4.3 being beta, and unrelated to the plugin code specifically, I will try again on master later and then try an older version to compare.

@Meythulhu
Copy link

Currently exploring using this plugin myself and I can concur this seems to be triggered on AddChild, even when the call is deferred. It only seems to be related to DialogueTrees which are loaded from the file system and not new DialogueTrees. It also seems to occur to be thrown on all types of Dialogue Nodes, based on my debugging.

I'm going to do a little more digging to try to get this fixed since this precisely fits my use case, but if it's unfixable I might have to roll with a custom dialogue tool.

@Meythulhu
Copy link

In my debugging I also noticed it's not just AddChild(), but also RemoveChild() when I add a brand new GraphNode to DialogueGraph in _Ready(). It might be related to how DialogueGraph is instantiated?

I also noticed that DialogueNode that GetUndoRedo() is called before the node is ready, resulting in an NRE. Unsure if this is related.

@Meythulhu
Copy link

Okay, so I'm suspecting this is a deeper issue with Godot and how it handles C# add-ons in 4.3. Unfortunately I seem to have run to dead ends while debugging, so the only workaround I found is only using the dialogue tree editor in 4.2, and moving the dialogue trees over to 4.3 and disabling loading the dialogue tree to prevent the crash, since the dialogue trees will load completely fine in-game.

Perhaps I'll be able to find a better workaround later down the road but for now I'm going to leave it at that.

@Meythulhu
Copy link

I reported this as a larger bug with Godot 4.3 here: godotengine/godot#96289

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants