Hello.

Does anyone know how queue_free interacts with signals and connections? Consider the following scenario:

I have a main scene. It instances a child scene and connects signals from the main scene to the child scene and children of the child scene. It also connects signals from children of the child scene to the main scene (bi-directional connections to listen to signals).

What happens to the connections between the main scene and children (child node and its children and vice-versa) when I queue_free() the child scene? What happens if I create a new instance of the child scene again? Will Godot remember those connections or do I have to reconnect them?

Let's say I want to destroy all connections when I queue_free() the child scene (and thus, its children). Will queue_free() do this for me or is there a better way of doing this? I know about destroying connections and setting ONESHOT and the other options, but I've done a few searches and I can't find any information to answer these questions.

I believe queue_free will remove the connections, or at least I have not had issues with connections and using queue_free. If you make a new instance, you will need to connect the connections again with any connections that are outside of the instanced scene itself.

a year later

So yes, queue_free will clean up all connections, and that's great, however if there are any active yields running on the child after queue_free is called, and then they receive the signal they're waiting for, then you will get a nice big error in the console, and on some compiled builds it can crash the game.

Though I personally have never seen the game crash from this, it has for others. So try not to yield when you think you might be queue_freed before the yield signal returns.

6 months later