godotsteam/multiplayerpeer
5
13
Fork
You've already forked multiplayerpeer
2

Fixed disconnect_peer crashing Godot on Linux #27

Merged
gramps merged 1 commit from bearlikelion/multiplayerpeer:main into main 2025年12月14日 06:26:57 +01:00
Contributor
Copy link

Similar to a previous PR I submitted there is another instance of removing the iterator during a for loop, causing a SIGSEGV error in Linux with the recent Multiplayer Peer.

Line 293 we iterate over steam_connections

		for (KeyValue<HSteamNetConnection, Ref<SteamPacketPeer>> &E :
				steam_connections) {

Then we execute disconnect_peer which modifies the steam_connections

My fix is the same as the previous PR. Build an array in the for loop, after iterating disconnect all the peers in the loop.

I'll be compiling in my builds and testing before releasing my update, looking for a merge / review on this PR.

Thanks,
Mark

Similar to [a previous PR I submitted](https://codeberg.org/godotsteam/multiplayerpeer/pulls/19) there is another instance of removing the iterator during a for loop, causing a **SIGSEGV** error in Linux with the recent Multiplayer Peer. [Line 293](https://codeberg.org/godotsteam/multiplayerpeer/src/commit/388f1a9d8c06946f477b585b29026cad5d584c44/godotsteam_multiplayer_peer.cpp#L293) we iterate over `steam_connections` ``` for (KeyValue<HSteamNetConnection, Ref<SteamPacketPeer>> &E : steam_connections) { ``` Then we execute [disconnect_peer](https://codeberg.org/godotsteam/multiplayerpeer/src/commit/388f1a9d8c06946f477b585b29026cad5d584c44/godotsteam_multiplayer_peer.cpp#L300) which [modifies the steam_connections ](https://codeberg.org/godotsteam/multiplayerpeer/src/branch/main/godotsteam_multiplayer_peer.cpp#L72) [My fix](https://codeberg.org/bearlikelion/multiplayerpeer/commit/6daab97ca1195e19b2d72b10cef2bae7f96662a1) is the same as the previous PR. Build an array in the for loop, after iterating disconnect all the peers in the loop. I'll be compiling in my builds and testing before releasing my update, looking for a merge / review on this PR. Thanks, Mark
cridenour left a comment
Copy link

LGTM.

LGTM.

Now it just needs ported into the main GodotSteam repository. I will get to that when I'm back in action!

Now it just needs ported into the main GodotSteam repository. I will get to that when I'm back in action!
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
godotsteam/multiplayerpeer!27
Reference in a new issue
godotsteam/multiplayerpeer
No description provided.
Delete branch "bearlikelion/multiplayerpeer:main"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?