Open tomdedecker opened 9 months ago
Does this still happen if the resource is declared as
#[export]
resource: Option<Gd<MyResource>>,
?
So far I haven't been able to reproduce it when wrapped in an Option, but even after making it required again I'm still having a hard time reproducing it. I'll experiment with it a bit and see if I can get it to crash when the resource is optional.
Are resources expected to always be optional or is this just to help diagnose the issue?
I was able to reproduce the crash in my actual project when I made my custom resource optional, but after restarting the editor I have yet to experience a new crash. Assuming the first crash was due to a limitation of the current hot reloading system, making the resource optional might indeed fix the issue. I'll keep you posted if I encounter it again.
@tomdedecker any updates yet? 🙂
As far as I can tell the issue remains as before. As long as the resource is not marked as optional, the editor seems to frequently crash when hot reloading. Marking the resource as optional and restarting the editor seems to avoid/bypass the issue, making subsequent hot reloads work as expected. I'm not sure if this is an issue on Godot's end or in gdext, but if there's any extra information I can provide I'd be happy to help.
Might also be fixed by #636.
A few days ago I started experimenting with custom resources for my gdext project and noticed that I started getting editor crashes every time (or at least most of the time) when I made a change to a node using a custom resource. Fast forward a bit and I was able to make a minimal reproducible example using a single node and resource. You can find it here or in the attached zip file.
gdext-reload-crash-master.zip
The scenario is as follows:
cargo build
insiderust/src/node.rs
ready()
At this point the editor typically crashes for me, producing one of 3 stack traces (as far as I encountered), which I've also added to the root of the repository. Two of these crashed in Godot's source code and the other inside the gdext project. I considered opening an issue with Godot's as I assumed that this might be a problem on their end, but I wanted to check here first.
I haven't tested this on any other platforms yet, but I can consistently reproduce it on my Linux (x86-64) install with Godot 4.2.1.
If you need any other info or if this is an issue I should check with Godot itself, please let me know.
Kind regards, Tom