Setting multiplayer_peer to null when peer disconnects crashes client

Godot Version

Godot v4.2.1

Question

As said in the title, I have a function connected to the signal multiplayer.peer_disconnected that sets multiplayer.multiplayer_peer to null.
Doing that crashes the clients, but not the server. If I deffer setting multiplayer_peer to null works but doesn’t feel correct. What is the correct way to terminate networking from the client perspective?

Extra: netiher godot or logs of appdata show any error, even when using --verbose

What code do you have on clients when they get the server_disconnected signal?

server_disconnected signal is not connected

You can do this on the server side. Otherwise the deferred call is perfectly fine. I assume by setting it to null may not be thread safe.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.