Skip to content

Fix thread safety in Godot callback trampolines#17

Closed
imperiumplay wants to merge 4 commits intomainfrom
bsharma/fix/godot-callback-threading
Closed

Fix thread safety in Godot callback trampolines#17
imperiumplay wants to merge 4 commits intomainfrom
bsharma/fix/godot-callback-threading

Conversation

@imperiumplay
Copy link
Collaborator

  • This should fix crash when callbacks are invoked from worker threads.

  • The callback trampolines were calling Godot API functions directly from the native SDK's worker thread, causing crashes with "can't call propagate_notification() from this thread" errors.

  • Changed to use call_deferred to queue callback execution on the main thread, matching the pattern already used for signal emission in colyseus_client.c.

  • Affects all platforms.

  • Not tested on local as I don't have linux machine myself but it passes our CI test cases: https://github.com/colyseus/native-sdk/actions/runs/22501056430

@imperiumplay imperiumplay self-assigned this Feb 27, 2026
@imperiumplay imperiumplay requested a review from endel as a code owner February 27, 2026 19:49
@imperiumplay imperiumplay added the bug Something isn't working label Feb 27, 2026
@endel
Copy link
Member

endel commented Feb 27, 2026

(EDITED: Moved comment to original issue: #8 (comment))

@imperiumplay
Copy link
Collaborator Author

Closing this, need testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants